From 5b8f0ddc7e5bc3c7ffe1b2226a8316796f18b90e Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 13 Mar 2012 01:06:07 +0000 Subject: Fix regression from r151466: an we can't replace uses of an instruction reachable from the entry block with uses of an instruction not reachable from the entry block. PR12231. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152595 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/InstructionSimplify.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/Analysis/InstructionSimplify.cpp') diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp index dd8b2634da..44f870c817 100644 --- a/lib/Analysis/InstructionSimplify.cpp +++ b/lib/Analysis/InstructionSimplify.cpp @@ -94,9 +94,13 @@ static bool ValueDominatesPHI(Value *V, PHINode *P, const DominatorTree *DT) { return true; // If we have a DominatorTree then do a precise test. - if (DT) - return !DT->isReachableFromEntry(P->getParent()) || - !DT->isReachableFromEntry(I->getParent()) || DT->dominates(I, P); + if (DT) { + if (!DT->isReachableFromEntry(P->getParent())) + return true; + if (!DT->isReachableFromEntry(I->getParent())) + return false; + return 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. -- cgit v1.2.3-18-g5258