[llvm-branch-commits] [llvm] [DA] Overflow check in WeakCrossing Delta calculation (PR #185046)
Ehsan Amiri via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Mar 6 13:00:18 PST 2026
================
@@ -1383,7 +1383,10 @@ bool DependenceInfo::weakCrossingSIVtest(const SCEVAddRecExpr *Src,
++WeakCrossingSIVapplications;
assert(0 < Level && Level <= CommonLevels && "Level out of range");
Level--;
- const SCEV *Delta = SE->getMinusSCEV(DstConst, SrcConst);
+ const SCEV *Delta = minusSCEVNoSignedOverflow(DstConst, SrcConst, *SE);
+ if (Delta == nullptr)
+ return false;
+
LLVM_DEBUG(dbgs() << "\t Delta = " << *Delta << "\n");
if (Delta->isZero()) {
----------------
amehsan wrote:
We can also limit the test to constant values of `SrcConst` and `DstConst`. That may make things a bit simpler. The check already exists in line 1399-1401. So the only cases for which we may lose something are cases in which `SrcConst` and `DstConst` are symbolic, but their subtraction is zero.
I will update the code to cover this case.
https://github.com/llvm/llvm-project/pull/185046
More information about the llvm-branch-commits
mailing list