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

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 22 20:14:46 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);
+    }
----------------
shiltian wrote:

Hmm, alright. It has been sitting there for 10+ years so my first reaction is, probably it was designed in that way...

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


More information about the llvm-commits mailing list