[llvm] [DependenceAnalysis] Extending SIV to handle separate loops (PR #128782)

Alireza Torabian via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 21 20:14:21 PDT 2025


================
@@ -3651,6 +3769,38 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst) {
     }
   }
 
+  // establish loop nesting levels considering separate but similar loops as
+  // common
+  establishNestingLevels(Src, Dst, true);
+  if (SeparateLevels > 0) {
+    // MIV is not handled yet on separate loops; check if there is any MIV test
+    for (unsigned P = 0; P < Pairs; ++P) {
+      Pair[P].Loops.resize(MaxLevels + 1);
+      auto classification = classifyPair(
+          Pair[P].Src, LI->getLoopFor(Src->getParent()), Pair[P].Dst,
+          LI->getLoopFor(Dst->getParent()), Pair[P].Loops);
+      if (classification == Subscript::MIV) {
----------------
1997alireza wrote:

SIV, RDIV or ZIV are able to handle pairs from different loops. RDIV and ZIV could do that before and SIV is able to handle it by this patch.

I cannot see a case where we may miss resolving any dependencies by considering separate loops optimization. Could you please clarify on that?

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


More information about the llvm-commits mailing list