[llvm] [Uniformity] Fixed control-div early stop (PR #139667)

Junjie Gu via llvm-commits llvm-commits at lists.llvm.org
Tue May 27 23:36:38 PDT 2025


================
@@ -626,14 +623,36 @@ template <typename ContextT> class DivergencePropagator {
         LLVM_DEBUG(dbgs() << "\tImmediate divergent cycle exit: "
                           << Context.print(SuccBlock) << "\n");
       }
-      auto SuccIdx = CyclePOT.getIndex(SuccBlock);
       visitEdge(*SuccBlock, *SuccBlock);
-      FloorIdx = std::min<int>(FloorIdx, SuccIdx);
     }
 
+    // Return true if B is inside an irreducible cycle
+    auto IsInIrreducibleCycle = [this](const BlockT *B) {
+      for (const auto *Cycle = CI.getCycle(B); Cycle;
+           Cycle = Cycle->getParentCycle()) {
+        // If everything is inside a reducible cycle, then look no further
+        if (Cycle->isReducible() && Cycle->contains(&DivTermBlock))
+          return false;
+        if (!Cycle->isReducible())
+          return true;
+      }
+      return false;
+    };
----------------
jgu222 wrote:

Yes, cherry-picked amd pushed.

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


More information about the llvm-commits mailing list