[llvm] [DependenceAnalysis] Extending SIV to handle fusable loops (PR #128782)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 18 08:49:34 PDT 2025
================
@@ -3686,6 +3775,46 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
}
}
+ // Establish loop nesting levels considering fusable loops as common
+ establishNestingLevels(Src, Dst);
+
+ LLVM_DEBUG(dbgs() << " common nesting levels = " << CommonLevels << "\n");
+ LLVM_DEBUG(dbgs() << " maximum nesting levels = " << MaxLevels << "\n");
+ LLVM_DEBUG(dbgs() << " fusable nesting levels = " << FusableLevels
+ << "\n");
+
+ // Modify common levels to consider the fusable levels in the tests
+ CommonLevels += FusableLevels;
+ MaxLevels -= FusableLevels;
+ if (FusableLevels > 0) {
+ // Not all tests are handled yet over fusable loops
+ // Revoke if there are any tests other than ZIV, SIV or RDIV
+ for (unsigned P = 0; P < Pairs; ++P) {
+ SmallBitVector Loops;
+ Subscript::ClassificationKind TestClass =
+ classifyPair(Pair[P].Src, LI->getLoopFor(Src->getParent()),
+ Pair[P].Dst, LI->getLoopFor(Dst->getParent()), Loops);
+
+ if (TestClass != Subscript::ZIV && TestClass != Subscript::SIV &&
+ TestClass != Subscript::RDIV) {
+ // Revert the levels to not consider the fusable levels
+ CommonLevels -= FusableLevels;
+ MaxLevels += FusableLevels;
+ FusableLevels = 0;
+ break;
+ }
+ }
+ }
+
+ FullDependence Result(Src, Dst, SCEVUnionPredicate(Assume, *SE),
+ PossiblyLoopIndependent, CommonLevels);
+ ++TotalArrayPairs;
+
+ if (FusableLevels > 0) {
+ Result.Consistent = false;
+ FusableLoopsConsidered++;
+ }
+
----------------
amehsan wrote:
Other fields of Result is updated later in line 4135. Also there is no use of `FusableLoopsConsidered` between here and there. Is there a reason that this code is separate from the other conditional on `FusableLevels > 0` ?
https://github.com/llvm/llvm-project/pull/128782
More information about the llvm-commits
mailing list