[PATCH] D12676: Ensure a complete post-dominance tree is built in the presence of unreachables

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 15:09:59 PDT 2015

Just for the reference, this patch adds back a feature that was part
of our original post dominator tree implementation, but was
dropped without specific comment or test case in the following

commit 1f23e163190f85e46f2009bf43ee4fe8299044e4
Author: Owen Anderson <resistor at mac.com>
Date:   Wed Apr 16 04:21:16 2008 +0000

     Major repairs to the post-dominators implementation.  Patch from Florian Brandner!
     git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49768

    inline void addRoot(NodeT* BB) {
-    // Unreachable block is not a root node.
-    if (!isa<UnreachableInst>(&BB->back()))
-      this->Roots.push_back(BB);
+    this->Roots.push_back(BB);

@Florian: do you remember why decided to add BBs that are terminated with UnreachableInst
as root nodes to the post-dominator tree? This causes the post-dominator tree to flatten
out. Maybe you can have a look at my patch: http://reviews.llvm.org/D12676


More information about the llvm-commits mailing list