aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/InstructionSimplify.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/InstructionSimplify.cpp')
-rw-r--r--lib/Analysis/InstructionSimplify.cpp10
1 files changed, 7 insertions, 3 deletions
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.