[llvm] [DA] Perform `nsw` check for SIV AddRecs earlier (NFCI) (PR #189740)

Ehsan Amiri via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 07:01:11 PDT 2026


================
@@ -2081,17 +2071,18 @@ bool DependenceInfo::testSIV(const SCEV *Src, const SCEV *Dst, unsigned &Level,
       disproven = weakCrossingSIVtest(SrcAddRec, DstAddRec, Level, Result);
     return disproven || exactSIVtest(SrcAddRec, DstAddRec, Level, Result);
   }
-  if (SrcAddRec) {
+  if (SrcAnalyzable && DstAddRec == nullptr) {
     const Loop *CurSrcLoop = SrcAddRec->getLoop();
     Level = mapSrcLoop(CurSrcLoop);
     return weakZeroDstSIVtest(SrcAddRec, Dst, Level, Result);
   }
-  if (DstAddRec) {
+  if (DstAnalyzable && SrcAddRec == nullptr) {
     const Loop *CurDstLoop = DstAddRec->getLoop();
     Level = mapDstLoop(CurDstLoop);
     return weakZeroSrcSIVtest(Src, DstAddRec, Level, Result);
   }
-  llvm_unreachable("SIV test expected at least one AddRec");
+  assert(SrcAddRec != nullptr ||
+         DstAddRec != nullptr && "SIV test expected at least one AddRec");
   return false;
----------------
amehsan wrote:

Thanks. I will fix it.

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


More information about the llvm-commits mailing list