@@ -457,10 +457,13 @@ static LinearExpression GetLinearExpression(
457
457
// / an issue, for example, in particular for 32b pointers with negative indices
458
458
// / that rely on two's complement wrap-arounds for precise alias information
459
459
// / where the maximum index size is 64b.
460
- static APInt adjustToIndexSize (const APInt &Offset, unsigned IndexSize) {
460
+ static void adjustToIndexSize (APInt &Offset, unsigned IndexSize) {
461
461
assert (IndexSize <= Offset.getBitWidth () && " Invalid IndexSize!" );
462
462
unsigned ShiftBits = Offset.getBitWidth () - IndexSize;
463
- return (Offset << ShiftBits).ashr (ShiftBits);
463
+ if (ShiftBits != 0 ) {
464
+ Offset <<= ShiftBits;
465
+ Offset.ashrInPlace (ShiftBits);
466
+ }
464
467
}
465
468
466
469
namespace {
@@ -685,7 +688,7 @@ BasicAAResult::DecomposeGEPExpression(const Value *V, const DataLayout &DL,
685
688
686
689
// Make sure that we have a scale that makes sense for this target's
687
690
// index size.
688
- Scale = adjustToIndexSize (Scale, IndexSize);
691
+ adjustToIndexSize (Scale, IndexSize);
689
692
690
693
if (!!Scale) {
691
694
VariableGEPIndex Entry = {LE.Val , Scale, CxtI, LE.IsNSW ,
@@ -696,7 +699,7 @@ BasicAAResult::DecomposeGEPExpression(const Value *V, const DataLayout &DL,
696
699
697
700
// Take care of wrap-arounds
698
701
if (GepHasConstantOffset)
699
- Decomposed. Offset = adjustToIndexSize (Decomposed.Offset , IndexSize);
702
+ adjustToIndexSize (Decomposed.Offset , IndexSize);
700
703
701
704
// Analyze the base pointer next.
702
705
V = GEPOp->getOperand (0 );
0 commit comments