aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Scalar/JumpThreading.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Scalar/JumpThreading.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/JumpThreading.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index 5caefc422921..b31eab50c5ec 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -1459,9 +1459,7 @@ bool JumpThreadingPass::simplifyPartiallyRedundantLoad(LoadInst *LoadI) {
// Add all the unavailable predecessors to the PredsToSplit list.
for (BasicBlock *P : predecessors(LoadBB)) {
// If the predecessor is an indirect goto, we can't split the edge.
- // Same for CallBr.
- if (isa<IndirectBrInst>(P->getTerminator()) ||
- isa<CallBrInst>(P->getTerminator()))
+ if (isa<IndirectBrInst>(P->getTerminator()))
return false;
if (!AvailablePredSet.count(P))
@@ -1685,9 +1683,8 @@ bool JumpThreadingPass::processThreadableEdges(Value *Cond, BasicBlock *BB,
}
// If the predecessor ends with an indirect goto, we can't change its
- // destination. Same for CallBr.
- if (isa<IndirectBrInst>(Pred->getTerminator()) ||
- isa<CallBrInst>(Pred->getTerminator()))
+ // destination.
+ if (isa<IndirectBrInst>(Pred->getTerminator()))
continue;
PredToDestList.emplace_back(Pred, DestBB);
@@ -1924,10 +1921,9 @@ bool JumpThreadingPass::processBranchOnXOR(BinaryOperator *BO) {
}
// If any of predecessors end with an indirect goto, we can't change its
- // destination. Same for CallBr.
+ // destination.
if (any_of(BlocksToFoldInto, [](BasicBlock *Pred) {
- return isa<IndirectBrInst>(Pred->getTerminator()) ||
- isa<CallBrInst>(Pred->getTerminator());
+ return isa<IndirectBrInst>(Pred->getTerminator());
}))
return false;
@@ -2173,6 +2169,9 @@ bool JumpThreadingPass::maybethreadThroughTwoBasicBlocks(BasicBlock *BB,
BasicBlock *ZeroPred = nullptr;
BasicBlock *OnePred = nullptr;
for (BasicBlock *P : predecessors(PredBB)) {
+ // If PredPred ends with IndirectBrInst, we can't handle it.
+ if (isa<IndirectBrInst>(P->getTerminator()))
+ continue;
if (ConstantInt *CI = dyn_cast_or_null<ConstantInt>(
evaluateOnPredecessorEdge(BB, P, Cond))) {
if (CI->isZero()) {