[llvm] [DependenceAnalysis] Fix SIV test crash when no AddRec after propagation (PR #154980)

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 24 15:36:01 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:

No. The propagate function does nothing, as you can see from the debug output of https://godbolt.org/z/Ydvosr4qT.

https://github.com/llvm/llvm-project/pull/154980


More information about the llvm-commits mailing list