[PATCH] D35142: WIP! [CFG] Create a new removeUnreachable utility that updates the dom in place

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 10 16:24:10 PDT 2017


efriedma added inline comments.


================
Comment at: lib/Transforms/Utils/Local.cpp:1727
+    auto *N = DT.getNode(BB);
+    if (!N) {
+      if (LVI)
----------------
I'm pretty sure N is always null here if the domtree is up-to-date.


================
Comment at: lib/Transforms/Utils/Local.cpp:1730
+        LVI->eraseBlock(BB);
+      BB->dropAllReferences();
+      BB->eraseFromParent();
----------------
The dropAllReferences call is redundant; the destructor for BasicBlock calls it for you.

An unreachable block can have reachable successors; you need to use removePredecessor to fix them up properly.


https://reviews.llvm.org/D35142





More information about the llvm-commits mailing list