summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/JumpThreading.cpp4
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp2
2 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index ab83553f81b..6ab00ee2b19 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -895,12 +895,14 @@ bool JumpThreading::ProcessImpliedCondition(BasicBlock *BB) {
BasicBlock *CurrentPred = BB->getSinglePredecessor();
unsigned Iter = 0;
+ auto &DL = BB->getModule()->getDataLayout();
+
while (CurrentPred && Iter++ < ImplicationSearchThreshold) {
auto *PBI = dyn_cast<BranchInst>(CurrentPred->getTerminator());
if (!PBI || !PBI->isConditional() || PBI->getSuccessor(0) != CurrentBB)
return false;
- if (isImpliedCondition(PBI->getCondition(), Cond)) {
+ if (isImpliedCondition(PBI->getCondition(), Cond, DL)) {
BI->getSuccessor(1)->removePredecessor(BB);
BranchInst::Create(BI->getSuccessor(0), BI);
BI->eraseFromParent();
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index b119d2df035..25b83e256a6 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -2686,7 +2686,7 @@ 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() &&
- isImpliedCondition(PBI->getCondition(), BI->getCondition()) &&
+ isImpliedCondition(PBI->getCondition(), BI->getCondition(), DL) &&
PBI->getSuccessor(0) != PBI->getSuccessor(1) &&
BB->getSinglePredecessor()) {
// Turn this into a branch on constant.
OpenPOWER on IntegriCloud