File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -492,11 +492,13 @@ void IRPromoter::PromoteTree() {
492
492
// SafeWrap because SafeWrap.size() is used elsewhere.
493
493
// For cmp, we need to sign extend a constant appearing in either
494
494
// operand. For add, we should only sign extend the RHS.
495
- Constant *NewConst = (SafeWrap.contains (I) &&
495
+ Constant *NewConst =
496
+ ConstantInt::get (Const->getContext (),
497
+ (SafeWrap.contains (I) &&
496
498
(I->getOpcode () == Instruction::ICmp || i == 1 ) &&
497
499
I->getOpcode () != Instruction::Sub)
498
- ? ConstantExpr::getSExt ( Const, ExtTy )
499
- : ConstantExpr::getZExt ( Const, ExtTy );
500
+ ? Const-> getValue (). sext (PromotedWidth )
501
+ : Const-> getValue (). zext (PromotedWidth) );
500
502
I->setOperand (i, NewConst);
501
503
} else if (isa<UndefValue>(Op))
502
504
I->setOperand (i, ConstantInt::get (ExtTy, 0 ));
You can’t perform that action at this time.
0 commit comments