Don't call dominates on unreachable instructions.

llvm-svn: 151466
This commit is contained in:
Rafael Espindola 2012-02-26 01:50:14 +00:00
parent 0d1f3cb1b5
commit c8c2b06a90
2 changed files with 3 additions and 2 deletions

View File

@ -820,7 +820,7 @@ public:
DT->splitBlock(NewBB); DT->splitBlock(NewBB);
} }
bool isReachableFromEntry(const BasicBlock* A) { bool isReachableFromEntry(const BasicBlock* A) const {
return DT->isReachableFromEntry(A); return DT->isReachableFromEntry(A);
} }

View File

@ -92,7 +92,8 @@ static bool ValueDominatesPHI(Value *V, PHINode *P, const DominatorTree *DT) {
// If we have a DominatorTree then do a precise test. // If we have a DominatorTree then do a precise test.
if (DT) if (DT)
return DT->dominates(I, P); return !DT->isReachableFromEntry(P->getParent()) ||
!DT->isReachableFromEntry(I->getParent()) || DT->dominates(I, P);
// Otherwise, if the instruction is in the entry block, and is not an invoke, // Otherwise, if the instruction is in the entry block, and is not an invoke,
// then it obviously dominates all phi nodes. // then it obviously dominates all phi nodes.