summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/PostDominators.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-10-04 14:50:20 +0000
committerChris Lattner <sabre@nondot.org>2002-10-04 14:50:20 +0000
commitd7b3bb0fa40896ed2af39441653e5dd269e70bfc (patch)
tree215412d9f0828c1b772fa28d719daf3d7a7d80d6 /llvm/lib/Analysis/PostDominators.cpp
parent2cedf1ce822182702e8bb25f8e5747abfecdd202 (diff)
downloadbcm5719-llvm-d7b3bb0fa40896ed2af39441653e5dd269e70bfc.tar.gz
bcm5719-llvm-d7b3bb0fa40896ed2af39441653e5dd269e70bfc.zip
Handle post dominance correctly in the case where blocks do not have a path to
the exit node. llvm-svn: 4038
Diffstat (limited to 'llvm/lib/Analysis/PostDominators.cpp')
-rw-r--r--llvm/lib/Analysis/PostDominators.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/PostDominators.cpp b/llvm/lib/Analysis/PostDominators.cpp
index 8b66ff6cad1..f027949793f 100644
--- a/llvm/lib/Analysis/PostDominators.cpp
+++ b/llvm/lib/Analysis/PostDominators.cpp
@@ -59,6 +59,18 @@ bool PostDominatorSet::runOnFunction(Function &F) {
if (PredSet.size())
set_intersect(WorkingSet, PredSet);
}
+ } else if (BB != Root) {
+ // If this isn't the root basic block and it has no successors, it must
+ // be an non-returning block. Fib a bit by saying that the root node
+ // postdominates this unreachable node. This isn't exactly true,
+ // because there is no path from this node to the root node, but it is
+ // sorta true because any paths to the exit node would have to go
+ // through this node.
+ //
+ // This allows for postdominator properties to be built for code that
+ // doesn't return in a reasonable manner.
+ //
+ WorkingSet = Doms[Root];
}
WorkingSet.insert(BB); // A block always dominates itself
OpenPOWER on IntegriCloud