summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/JumpThreading.cpp
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@codeaurora.org>2016-04-25 17:23:36 +0000
committerChad Rosier <mcrosier@codeaurora.org>2016-04-25 17:23:36 +0000
commite2cbd13e5634e16301cd9e4b88b5ea08accafe9f (patch)
tree21cf5562f959fc1476cb2b129c884fb939e74267 /llvm/lib/Transforms/Scalar/JumpThreading.cpp
parent8d728fccb8266004f23485a9b336825d2fa79fd8 (diff)
downloadbcm5719-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/Scalar/JumpThreading.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/JumpThreading.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index ba406a8e8b3..75c340fd593 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -925,11 +925,14 @@ bool JumpThreading::ProcessImpliedCondition(BasicBlock *BB) {
while (CurrentPred && Iter++ < ImplicationSearchThreshold) {
auto *PBI = dyn_cast<BranchInst>(CurrentPred->getTerminator());
- if (!PBI || !PBI->isConditional() || PBI->getSuccessor(0) != CurrentBB)
+ if (!PBI || !PBI->isConditional())
+ return false;
+ if (PBI->getSuccessor(0) != CurrentBB && PBI->getSuccessor(1) != CurrentBB)
return false;
+ bool FalseDest = PBI->getSuccessor(1) == CurrentBB;
Optional<bool> Implication =
- isImpliedCondition(PBI->getCondition(), Cond, DL);
+ isImpliedCondition(PBI->getCondition(), Cond, DL, FalseDest);
if (Implication) {
BI->getSuccessor(*Implication ? 1 : 0)->removePredecessor(BB);
BranchInst::Create(BI->getSuccessor(*Implication ? 0 : 1), BI);
OpenPOWER on IntegriCloud