From 13b25df0e927dd70b9fa60f2a354ce2c63a689bb Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Tue, 24 Jul 2007 01:02:25 +0000 Subject: Unreachable block is not a root node in post dominator tree. llvm-svn: 40458 --- llvm/lib/Analysis/PostDominators.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Analysis/PostDominators.cpp') diff --git a/llvm/lib/Analysis/PostDominators.cpp b/llvm/lib/Analysis/PostDominators.cpp index 48f7b30866f..1188cff0303 100644 --- a/llvm/lib/Analysis/PostDominators.cpp +++ b/llvm/lib/Analysis/PostDominators.cpp @@ -112,8 +112,12 @@ void PostDominatorTree::calculate(Function &F) { // relationships. These blocks, which have no successors, end with return and // unwind instructions. for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) - if (succ_begin(I) == succ_end(I)) - Roots.push_back(I); + if (succ_begin(I) == succ_end(I)) { + Instruction *Insn = I->getTerminator(); + // Unreachable block is not a root node. + if (!isa(Insn)) + Roots.push_back(I); + } Vertex.push_back(0); -- cgit v1.2.3