diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2012-03-13 01:06:07 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2012-03-13 01:06:07 +0000 |
| commit | c8cbd06947cf0291bb07de77f8a8bcccf2aac3d1 (patch) | |
| tree | b884b6d958cf915c2ee810b0eaad50d8f1c45d03 /llvm/lib | |
| parent | b0712f8e68484633392b501836712013621f2568 (diff) | |
| download | bcm5719-llvm-c8cbd06947cf0291bb07de77f8a8bcccf2aac3d1.tar.gz bcm5719-llvm-c8cbd06947cf0291bb07de77f8a8bcccf2aac3d1.zip | |
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.
llvm-svn: 152595
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Analysis/InstructionSimplify.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index dd8b2634da6..44f870c8179 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/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. |

