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

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 11 08:16:49 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) {
----------------
Meinersbur wrote:

`MIV` gets it special treatment here, with reverting to old scheme, but what about RDIV, ZIV? 

`classifyPair` itself relies on the old counting scheme, and will classify e.g. what was RDIV before to SIV.

There is also the case that with non-fused interpretation, we actually might be able to resolve dependencies, but do not with ConsiderSeparateLoops. What ensures that does not happen?

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


More information about the llvm-commits mailing list