[llvm] [DA] Rewrite the formula in the Strong SIV test (PR #179665)
Ehsan Amiri via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 8 13:29:55 PST 2026
================
@@ -1353,38 +1331,55 @@ bool DependenceInfo::strongSIVtest(const SCEV *Coeff, const SCEV *SrcConst,
assert(0 < Level && Level <= CommonLevels && "level out of range");
Level--;
- const SCEV *Delta = minusSCEVNoSignedOverflow(SrcConst, DstConst, *SE);
- if (!Delta) {
- Result.Consistent = false;
- return false;
- }
- LLVM_DEBUG(dbgs() << "\t Delta = " << *Delta);
- LLVM_DEBUG(dbgs() << ", " << *Delta->getType() << "\n");
-
- // check that |Delta| < iteration count
- bool IsDeltaLarge = [&] {
- const SCEV *UpperBound = collectUpperBound(CurSrcLoop, Delta->getType());
+ // Src: [a*0 + c1], [a*1 + c1], [a*2 + c1], ..., [a*BTC + c1]
+ // Dst: [a*0 + c2], [a*1 + c2], [a*2 + c2], ..., [a*BTC + c2]
+ //
+ // When 0 <=s a, we can prove independence if:
+ //
+ // (a*BTC + c1 <s a*0 + c2) or (a*BTC + c2 <s a*0 + c1)
+ //
+ // When a <s 0, we can prove independence if:
+ //
+ // (a*0 + c1 <s a*BTC + c2) or (a*0 + c2 <s a*BTC + c1)
----------------
amehsan wrote:
> Sorry, but I don't really understand what you are talking about. It's already possible for nowrap flags to be set on expressions that are conditionally executed (or even on expressions that are not present in the IR).
Yes, I remember the example that you once gave. The problem may exist for that case too. Let me try to come up with something more concrete. An example or at least parts of an example. Will get back to you about it.
https://github.com/llvm/llvm-project/pull/179665
More information about the llvm-commits
mailing list