Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 68dccb9

Browse files
authored
[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.
1 parent 4589911 commit 68dccb9

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

llvm/lib/Analysis/LoopAccessAnalysis.cpp

-17
Original file line numberDiff line numberDiff line change
@@ -2861,23 +2861,6 @@ static const SCEV *getStrideFromPointer(Value *Ptr, ScalarEvolution *SE, Loop *L
28612861

28622862
V = S->getStepRecurrence(*SE);
28632863

2864-
// Strip off the size of access multiplication if we are still analyzing the
2865-
// pointer.
2866-
if (OrigPtr == Ptr) {
2867-
if (auto *M = dyn_cast<SCEVMulExpr>(V)) {
2868-
auto *StepConst = dyn_cast<SCEVConstant>(M->getOperand(0));
2869-
if (!StepConst)
2870-
return nullptr;
2871-
2872-
auto StepVal = StepConst->getAPInt().trySExtValue();
2873-
// Bail out on a non-unit pointer access size.
2874-
if (!StepVal || StepVal != 1)
2875-
return nullptr;
2876-
2877-
V = M->getOperand(1);
2878-
}
2879-
}
2880-
28812864
// Note that the restriction after this loop invariant check are only
28822865
// profitability restrictions.
28832866
if (!SE->isLoopInvariant(V, Lp))

0 commit comments

Comments
 (0)