@@ -617,7 +617,7 @@ Value MathBuilder::constant(Type type, double val) const {
617617 b ().create <arith::ConstantOp>(loc (), b ().getF64FloatAttr (val));
618618 })
619619 .Case <IntegerType>([&](IntegerType elementType) {
620- assert (val == ( int64_t ) val && " value is ambiguous" );
620+ assert (val == static_cast < int64_t >( val) && " value is ambiguous" );
621621 unsigned width = elementType.getWidth ();
622622
623623 if (width == 1 )
@@ -628,11 +628,13 @@ Value MathBuilder::constant(Type type, double val) const {
628628 if (elementType.isUnsignedInteger ()) {
629629 Type signlessTy = b ().getIntegerType (width);
630630 constant = b ().create <arith::ConstantOp>(loc (),
631- b ().getIntegerAttr (signlessTy, APInt (width, (int64_t )val)));
631+ b ().getIntegerAttr (signlessTy,
632+ APInt (width, static_cast <int64_t >(val), false , true )));
632633 constant = castToUnsigned (constant, width);
633634 } else {
634635 constant = b ().create <arith::ConstantOp>(loc (),
635- b ().getIntegerAttr (elementType, APInt (width, (int64_t )val)));
636+ b ().getIntegerAttr (elementType,
637+ APInt (width, static_cast <int64_t >(val), false , true )));
636638 }
637639 }
638640 })
@@ -695,7 +697,7 @@ TypedAttr MathBuilder::negativeInfAttr(Type type) const {
695697 default :
696698 llvm_unreachable (" unsupported element type" );
697699 }
698- attr = b ().getIntegerAttr (type, APInt (width, value));
700+ attr = b ().getIntegerAttr (type, APInt (width, value, false , true ));
699701 })
700702 .Default ([](Type) { llvm_unreachable (" unsupported element type" ); });
701703 assert (attr != nullptr && " Expecting valid attribute" );
@@ -740,7 +742,7 @@ TypedAttr MathBuilder::positiveInfAttr(Type type) const {
740742 default :
741743 llvm_unreachable (" unsupported element type" );
742744 }
743- attr = b ().getIntegerAttr (type, APInt (width, value));
745+ attr = b ().getIntegerAttr (type, APInt (width, value, false , true ));
744746 })
745747 .Default ([](Type) { llvm_unreachable (" unsupported element type" ); });
746748 assert (attr != nullptr && " Expecting valid attribute" );
@@ -2263,7 +2265,8 @@ Value LLVMBuilder::constant(Type type, int64_t val) const {
22632265 assert (type.isSignless () &&
22642266 " LLVM::ConstantOp requires a signless type." );
22652267 constant = b ().create <LLVM::ConstantOp>(loc (), type,
2266- b ().getIntegerAttr (type, APInt (width, (int64_t )val)));
2268+ b ().getIntegerAttr (
2269+ type, APInt (width, static_cast <int64_t >(val), false , true )));
22672270 }
22682271 })
22692272 .Case <IndexType>([&](Type) {
0 commit comments