[llvm] [StructurizeCFG] Fix a crash caused by not updating `Predicates` properly (PR #124051)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 22 20:07:44 PST 2025


================
@@ -971,6 +971,10 @@ void StructurizeCFG::changeExit(RegionNode *Node, BasicBlock *NewExit,
     SubRegion->replaceExit(NewExit);
   } else {
     BasicBlock *BB = Node->getNodeAs<BasicBlock>();
+    for (BasicBlock *Succ : successors(BB)) {
+      if (Succ != NewExit)
+        Predicates[Succ].erase(BB);
+    }
----------------
arsenm wrote:

What makes you think it's on purpose? 

The predicates collects branch conditions used in the CFG, so it makes sense to me that you would need to adjust those when the CFG changes 

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


More information about the llvm-commits mailing list