@@ -680,35 +680,28 @@ Constant *FatPtrConstMaterializer::materializeBufferFatPtrConst(Constant *C) {
680
680
report_fatal_error (
681
681
" Scalable vector or unsized struct in fat pointer GEP" );
682
682
Constant *OffAccum = nullptr ;
683
- // Accumulate offsets together before adding to the base in order to
684
- // preserve as many of the inbounds properties as possible.
685
683
for (auto [Arg, Multiple] : VariableOffs) {
686
684
Constant *NewArg = InternalMapper.mapConstant (*cast<Constant>(Arg));
687
685
NewArg = ConstantFoldIntegerCast (NewArg, OffTy, /* IsSigned=*/ true , DL);
688
686
if (!Multiple.isOne ()) {
689
687
if (Multiple.isPowerOf2 ()) {
690
688
NewArg = ConstantExpr::getShl (
691
- NewArg,
692
- CE->getIntegerValue (
693
- OffTy, APInt (BufferOffsetWidth, Multiple.logBase2 ())),
694
- /* hasNUW=*/ InBounds, /* HasNSW=*/ InBounds);
689
+ NewArg, CE->getIntegerValue (OffTy, APInt (BufferOffsetWidth,
690
+ Multiple.logBase2 ())));
695
691
} else {
696
- NewArg =
697
- ConstantExpr::getMul (NewArg, CE->getIntegerValue (OffTy, Multiple),
698
- /* hasNUW=*/ InBounds, /* hasNSW=*/ InBounds);
692
+ NewArg = ConstantExpr::getMul (NewArg,
693
+ CE->getIntegerValue (OffTy, Multiple));
699
694
}
700
695
}
701
696
if (OffAccum) {
702
- OffAccum = ConstantExpr::getAdd (OffAccum, NewArg, /* hasNUW=*/ InBounds,
703
- /* hasNSW=*/ InBounds);
697
+ OffAccum = ConstantExpr::getAdd (OffAccum, NewArg);
704
698
} else {
705
699
OffAccum = NewArg;
706
700
}
707
701
}
708
702
Constant *NewConstOff = CE->getIntegerValue (OffTy, NewConstOffVal);
709
703
if (OffAccum)
710
- OffAccum = ConstantExpr::getAdd (OffAccum, NewConstOff,
711
- /* hasNUW=*/ InBounds, /* hasNSW=*/ InBounds);
704
+ OffAccum = ConstantExpr::getAdd (OffAccum, NewConstOff);
712
705
else
713
706
OffAccum = NewConstOff;
714
707
bool HasNonNegativeOff = false ;
0 commit comments