return false;
BasicBlock *BB = BI->getParent();
-
- bool Changed = false;
-
TargetTransformInfo::TargetCostKind CostKind =
BB->getParent()->hasMinSize() ? TargetTransformInfo::TCK_CodeSize
: TargetTransformInfo::TCK_SizeAndLatency;
if (!Cond || (!isa<CmpInst>(Cond) && !isa<BinaryOperator>(Cond)) ||
Cond->getParent() != BB || !Cond->hasOneUse())
- return Changed;
+ return false;
// Cond is known to be a compare or binary operator. Check to make sure that
// neither operand is a potentially-trapping constant expression.
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Cond->getOperand(0)))
if (CE->canTrap())
- return Changed;
+ return false;
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Cond->getOperand(1)))
if (CE->canTrap())
- return Changed;
+ return false;
// Finally, don't infinitely unroll conditional loops.
if (is_contained(successors(BB), BB))
- return Changed;
+ return false;
// With which predecessors will we want to deal with?
SmallVector<BasicBlock *, 8> Preds;
// If there aren't any predecessors into which we can fold,
// don't bother checking the cost.
if (Preds.empty())
- return Changed;
+ return false;
// Only allow this transformation if computing the condition doesn't involve
// too many instructions and these involved instructions can be executed
continue;
// I must be safe to execute unconditionally.
if (!isSafeToSpeculativelyExecute(&I))
- return Changed;
+ return false;
// Account for the cost of duplicating this instruction into each
// predecessor.
NumBonusInsts += PredCount;
// Early exits once we reach the limit.
if (NumBonusInsts > BonusInstThreshold)
- return Changed;
+ return false;
}
// Ok, we have the budget. Perform the transformation.
auto *PBI = cast<BranchInst>(PredBlock->getTerminator());
return performBranchToCommonDestFolding(BI, PBI, DTU, MSSAU, TTI);
}
- return Changed;
+ return false;
}
// If there is only one store in BB1 and BB2, return it, otherwise return