[llvm] [LAA] Rewrite findForkedPointer, fixing freeze (PR #140298)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Mon May 19 03:21:55 PDT 2025
================
@@ -1088,29 +1092,49 @@ static void findForkedSCEVs(
}
}
-static SmallVector<PointerIntPair<const SCEV *, 1, bool>>
-findForkedPointer(PredicatedScalarEvolution &PSE,
- const DenseMap<Value *, const SCEV *> &StridesMap, Value *Ptr,
- const Loop *L) {
- ScalarEvolution *SE = PSE.getSE();
- assert(SE->isSCEVable(Ptr->getType()) && "Value is not SCEVable!");
- SmallVector<PointerIntPair<const SCEV *, 1, bool>> Scevs;
- findForkedSCEVs(SE, L, Ptr, Scevs, MaxForkedSCEVDepth);
-
- // For now, we will only accept a forked pointer with two possible SCEVs
- // that are either SCEVAddRecExprs or loop invariant.
- if (Scevs.size() == 2 &&
----------------
artagnon wrote:
No, not at all. If you see the original code after this `if`, it is:
```cpp
return {{replaceSymbolicStrideSCEV(PSE, StridesMap, Ptr), false}};
```
... which isn't guarded by size() == 1, and it inadvertently drops freeze.
https://github.com/llvm/llvm-project/pull/140298
More information about the llvm-commits
mailing list