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

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 13 15:15:27 PST 2026


================
@@ -120,65 +113,134 @@ class ReachabilityGraph {
     assert(I != LoopEnterers.end());
     return I->second;
   }
+  unsigned getSCCId(MachineBasicBlock *MBB) const {
+    return SccId[getIndex(MBB)];
+  }
 
 private:
   MachineBasicBlock *Entry;
   const BlockSet &Blocks;
+  DenseMap<MachineBasicBlock *, unsigned> BlockIndex;
 
   BlockSet Loopers, LoopEntries;
   DenseMap<MachineBasicBlock *, BlockSet> LoopEnterers;
 
   bool inRegion(MachineBasicBlock *MBB) const { return Blocks.count(MBB); }
 
-  // Maps a block to all the other blocks it can reach.
-  DenseMap<MachineBasicBlock *, BlockSet> Reachable;
+  // Per-node adjacency in the region (excluding edges to Entry).
+  SmallVector<SmallVector<unsigned, 4>, 0> Succs;
+  SmallVector<bool, 0> SelfLoop;
+  SmallVector<unsigned, 0> SccId;
+  SmallVector<unsigned, 0> SccSize;
----------------
dschuff wrote:

Can you add comments explaining what these are for and what the indices mean?

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


More information about the llvm-commits mailing list