forked from OSchip/llvm-project
EDSC printing: handle integer attributes with bitwidth > 64
This came up in post-submit review. Use LLVM's support for outputting APInt values directly instead of obtaining a 64-bit integer value from APInt, which will not work for wider integers. PiperOrigin-RevId: 235531574
This commit is contained in:
parent
4887e45546
commit
ec76f9c8c1
|
@ -767,8 +767,10 @@ void mlir::edsc::Expr::print(raw_ostream &os) const {
|
|||
// sign-extended result for everything but i1 (booleans).
|
||||
if (this->is_op<ConstantIndexOp>() || this->is_op<ConstantIntOp>()) {
|
||||
APInt value = getAttribute("value").cast<IntegerAttr>().getValue();
|
||||
os << (value.getBitWidth() == 1 ? value.getZExtValue()
|
||||
: value.getSExtValue());
|
||||
if (value.getBitWidth() == 1)
|
||||
os << value.getZExtValue();
|
||||
else
|
||||
os << value;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue