[llvm] [WebAssembly] Replace Reachability with SCCs in Irreducible CFG Fixer (PR #179722)

Heejin Ahn via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 14 06:35:13 PST 2026


================
@@ -98,16 +99,8 @@ class ReachabilityGraph {
     calculate();
   }
 
-  bool canReach(MachineBasicBlock *From, MachineBasicBlock *To) const {
-    assert(inRegion(From) && inRegion(To));
-    auto I = Reachable.find(From);
-    if (I == Reachable.end())
-      return false;
-    return I->second.count(To);
-  }
-
   // "Loopers" are blocks that are in a loop. We detect these by finding blocks
-  // that can reach themselves.
+  // that are in a non-trivial SCC or have a self-loop.
----------------
aheejin wrote:

This was not easy to understand for me too. Can we change "non-trivial SCC" to "SCC with size greater than 1" and add the explanation that the algorithm identifies every (even non self-looping) node as its own size 1 SCC?

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


More information about the llvm-commits mailing list