[llvm] [DependenceAnalysis] Fix SIV test crash when no AddRec after propagation (PR #154980)
Ryotaro Kasuga via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 22 11:45:52 PDT 2025
================
@@ -2281,8 +2290,14 @@ bool DependenceInfo::testSIV(const SCEV *Src, const SCEV *Dst, unsigned &Level,
Result, NewConstraint) ||
gcdMIVtest(Src, Dst, Result);
}
- llvm_unreachable("SIV test expected at least one AddRec");
- return false;
+ // If neither expression is an AddRec, this means propagation has simplified
+ // them to non-AddRec forms. In this case, fall back to ZIV analysis since
+ // the expressions are effectively loop-invariant.
+ LLVM_DEBUG(dbgs() << " falling back to ZIV test due to no AddRec\n");
----------------
kasuga-fj wrote:
The original issue triggers this assertion in the following condition. They are clearly not loop-invariants.
```
SIV
src = (sext i1 {false,+,true}<%loop> to i64)
dst = (sext i1 {false,+,true}<%loop> to i64)
SIV test expected at least one AddRec
UNREACHABLE executed at /root/llvm-project/llvm/lib/Analysis/DependenceAnalysis.cpp:2295!
```
https://github.com/llvm/llvm-project/pull/154980
More information about the llvm-commits
mailing list