[llvm] [DependenceAnalysis] Extending SIV to handle fusable loops (PR #128782)
Alireza Torabian via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 18 15:59:01 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;
+ }
+ }
+ }
----------------
1997alireza wrote:
classifyPair uses CommonLevels and MaxLevels. To be able to identify the dependency types considering the fusable levels, the value of levels must be modified before calling classifyPair.
https://github.com/llvm/llvm-project/pull/128782
More information about the llvm-commits
mailing list