diff options
author | Chad Rosier <mcrosier@codeaurora.org> | 2016-04-25 17:23:36 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@codeaurora.org> | 2016-04-25 17:23:36 +0000 |
commit | e2cbd13e5634e16301cd9e4b88b5ea08accafe9f (patch) | |
tree | 21cf5562f959fc1476cb2b129c884fb939e74267 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | 8d728fccb8266004f23485a9b336825d2fa79fd8 (diff) | |
download | bcm5719-llvm-e2cbd13e5634e16301cd9e4b88b5ea08accafe9f.tar.gz bcm5719-llvm-e2cbd13e5634e16301cd9e4b88b5ea08accafe9f.zip |
[ValueTracking] Improve isImpliedCondition when the dominating cond is false.
llvm-svn: 267430
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 53bea2191bc..23199b37b29 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -2703,11 +2703,13 @@ static bool SimplifyCondBranchToCondBranch(BranchInst *PBI, BranchInst *BI, // If BI is reached from the true path of PBI and PBI's condition implies // BI's condition, we know the direction of the BI branch. - if (PBI->getSuccessor(0) == BI->getParent() && + if ((PBI->getSuccessor(0) == BI->getParent() || + PBI->getSuccessor(1) == BI->getParent()) && PBI->getSuccessor(0) != PBI->getSuccessor(1) && BB->getSinglePredecessor()) { - Optional<bool> Implication = - isImpliedCondition(PBI->getCondition(), BI->getCondition(), DL); + bool FalseDest = PBI->getSuccessor(1) == BI->getParent(); + Optional<bool> Implication = isImpliedCondition( + PBI->getCondition(), BI->getCondition(), DL, FalseDest); if (Implication) { // Turn this into a branch on constant. auto *OldCond = BI->getCondition(); |