aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LoopAccessAnalysis.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2024-12-10 13:05:34 +0100
committerGitHub <noreply@github.com>2024-12-10 13:05:34 +0100
commitbc0976ed1f96c20546796d4aa18abf3acfc0850f (patch)
tree9a9684e74e16f271ebac1c461a2c90d972c89dde /llvm/lib/Analysis/LoopAccessAnalysis.cpp
parentef4f8589e8e16d016119b7b8c2831ac406e8b97e (diff)
downloadllvm-bc0976ed1f96c20546796d4aa18abf3acfc0850f.zip
llvm-bc0976ed1f96c20546796d4aa18abf3acfc0850f.tar.gz
llvm-bc0976ed1f96c20546796d4aa18abf3acfc0850f.tar.bz2
[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.
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/LoopAccessAnalysis.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 71582d5..2c75d56 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -1566,10 +1566,10 @@ std::optional<int> llvm::getPointersDiff(Type *ElemTyA, Value *PtrA,
unsigned IdxWidth = DL.getIndexSizeInBits(ASA);
APInt OffsetA(IdxWidth, 0), OffsetB(IdxWidth, 0);
- const Value *PtrA1 =
- PtrA->stripAndAccumulateInBoundsConstantOffsets(DL, OffsetA);
- const Value *PtrB1 =
- PtrB->stripAndAccumulateInBoundsConstantOffsets(DL, OffsetB);
+ const Value *PtrA1 = PtrA->stripAndAccumulateConstantOffsets(
+ DL, OffsetA, /*AllowNonInbounds=*/true);
+ const Value *PtrB1 = PtrB->stripAndAccumulateConstantOffsets(
+ DL, OffsetB, /*AllowNonInbounds=*/true);
int Val;
if (PtrA1 == PtrB1) {