Skip to content

Commit bc0976e

Browse files
authored
[LAA] Strip non-inbounds offset in getPointerDiff() (NFC) (#118665)
I believe that this code doesn't care whether the offsets are known to be inbounds a priori. For the same reason the change is not testable, as the SCEV based fallback code will look through non-inbounds offsets anyway. So make it clear that there is no special inbounds requirement here.
1 parent ef4f858 commit bc0976e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Analysis/LoopAccessAnalysis.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,10 +1566,10 @@ std::optional<int> llvm::getPointersDiff(Type *ElemTyA, Value *PtrA,
15661566
unsigned IdxWidth = DL.getIndexSizeInBits(ASA);
15671567

15681568
APInt OffsetA(IdxWidth, 0), OffsetB(IdxWidth, 0);
1569-
const Value *PtrA1 =
1570-
PtrA->stripAndAccumulateInBoundsConstantOffsets(DL, OffsetA);
1571-
const Value *PtrB1 =
1572-
PtrB->stripAndAccumulateInBoundsConstantOffsets(DL, OffsetB);
1569+
const Value *PtrA1 = PtrA->stripAndAccumulateConstantOffsets(
1570+
DL, OffsetA, /*AllowNonInbounds=*/true);
1571+
const Value *PtrB1 = PtrB->stripAndAccumulateConstantOffsets(
1572+
DL, OffsetB, /*AllowNonInbounds=*/true);
15731573

15741574
int Val;
15751575
if (PtrA1 == PtrB1) {

0 commit comments

Comments
 (0)