From: Rafael Espindola Date: Sun, 26 Feb 2012 01:50:14 +0000 (+0000) Subject: Don't call dominates on unreachable instructions. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8c727f9200cd54adc4a1b742950e80035bc53a20;p=oota-llvm.git Don't call dominates on unreachable instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151466 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index b539a788a22..58730731473 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -820,7 +820,7 @@ public: DT->splitBlock(NewBB); } - bool isReachableFromEntry(const BasicBlock* A) { + bool isReachableFromEntry(const BasicBlock* A) const { return DT->isReachableFromEntry(A); } diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp index 37253f72cf6..b518d0ca71c 100644 --- a/lib/Analysis/InstructionSimplify.cpp +++ b/lib/Analysis/InstructionSimplify.cpp @@ -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 (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, // then it obviously dominates all phi nodes.