[llvm] [DA] Require 'nsw' for AddRecs in the WeakCrossing SIV test (PR #185041)

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 10 21:59:18 PDT 2026


================
@@ -1366,15 +1366,28 @@ bool DependenceInfo::strongSIVtest(const SCEVAddRecExpr *Src,
 // Can determine iteration for splitting.
 //
 // Return true if dependence disproved.
-bool DependenceInfo::weakCrossingSIVtest(const SCEV *Coeff,
-                                         const SCEV *SrcConst,
-                                         const SCEV *DstConst,
-                                         const Loop *CurSrcLoop,
-                                         const Loop *CurDstLoop, unsigned Level,
+bool DependenceInfo::weakCrossingSIVtest(const SCEVAddRecExpr *Src,
+                                         const SCEVAddRecExpr *Dst,
+                                         unsigned Level,
                                          FullDependence &Result) const {
   if (!isDependenceTestEnabled(DependenceTestType::WeakCrossingSIV))
     return false;
 
+  if (!Src->hasNoSignedWrap() || !Dst->hasNoSignedWrap())
+    return false;
+
+  const SCEV *Coeff = Src->getStepRecurrence(*SE);
+  const SCEV *DstCoeff = Dst->getStepRecurrence(*SE);
+  assert(Coeff ==  SE->getNegativeSCEV(DstCoeff) && "Not a weak crossing case.");
----------------
kasuga-fj wrote:

```suggestion
  assert(Coeff == SE->getNegativeSCEV(Dst->getStepRecurrence(*SE)) && "Not a weak crossing case.");
```

To suppress a warning in non-assertion build.

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


More information about the llvm-commits mailing list