diff options
| author | Devang Patel <dpatel@apple.com> | 2007-07-24 01:02:25 +0000 |
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2007-07-24 01:02:25 +0000 |
| commit | 13b25df0e927dd70b9fa60f2a354ce2c63a689bb (patch) | |
| tree | 3a8ce7509da89d367750d42f92586dfb39e4922f /llvm/lib/Analysis/PostDominators.cpp | |
| parent | 9baaaa52e6c51c16ad7bcd6fb7a5acba4a45ca3b (diff) | |
| download | bcm5719-llvm-13b25df0e927dd70b9fa60f2a354ce2c63a689bb.tar.gz bcm5719-llvm-13b25df0e927dd70b9fa60f2a354ce2c63a689bb.zip | |
Unreachable block is not a root node in post dominator tree.
llvm-svn: 40458
Diffstat (limited to 'llvm/lib/Analysis/PostDominators.cpp')
| -rw-r--r-- | llvm/lib/Analysis/PostDominators.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
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<UnreachableInst>(Insn)) + Roots.push_back(I); + } Vertex.push_back(0); |

