[llvm] 68dccb9 - [LAA] Strip dead code in getStrideFromPointer (NFC) (#139140)
via llvm-commits
llvm-commits at lists.llvm.org
Fri May 9 01:20:53 PDT 2025
Author: Ramkumar Ramachandra
Date: 2025-05-09T09:20:50+01:00
New Revision: 68dccb9fa0b09b3485acfc0d436c1d66a4089b8f
URL: https://github.com/llvm/llvm-project/commit/68dccb9fa0b09b3485acfc0d436c1d66a4089b8f
DIFF: https://github.com/llvm/llvm-project/commit/68dccb9fa0b09b3485acfc0d436c1d66a4089b8f.diff
LOG: [LAA] Strip dead code in getStrideFromPointer (NFC) (#139140)
The SCEV multiply by 1 doesn't make sense, because SCEV would fold it:
therefore, the OrigPtr == Ptr branch effectively rejects a multiply.
However, in this branch, we have a pointer SCEV that cannot be a
multiply, and hence the code the code is dead. Strip it.
Added:
Modified:
llvm/lib/Analysis/LoopAccessAnalysis.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 535b71cd5897e..438669df51f89 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -2861,23 +2861,6 @@ static const SCEV *getStrideFromPointer(Value *Ptr, ScalarEvolution *SE, Loop *L
V = S->getStepRecurrence(*SE);
- // Strip off the size of access multiplication if we are still analyzing the
- // pointer.
- if (OrigPtr == Ptr) {
- if (auto *M = dyn_cast<SCEVMulExpr>(V)) {
- auto *StepConst = dyn_cast<SCEVConstant>(M->getOperand(0));
- if (!StepConst)
- return nullptr;
-
- auto StepVal = StepConst->getAPInt().trySExtValue();
- // Bail out on a non-unit pointer access size.
- if (!StepVal || StepVal != 1)
- return nullptr;
-
- V = M->getOperand(1);
- }
- }
-
// Note that the restriction after this loop invariant check are only
// profitability restrictions.
if (!SE->isLoopInvariant(V, Lp))
More information about the llvm-commits
mailing list