/// Returns true if \p I is an instruction that needs to be predicated
/// at runtime. The result is independent of the predication mechanism.
- /// \p VF is the vectorization factor that will be used to vectorize \p I.
/// Superset of instructions that return true for isScalarWithPredication.
- bool isPredicatedInst(Instruction *I, ElementCount VF) const;
+ bool isPredicatedInst(Instruction *I) const;
/// Returns true if \p I is a memory instruction with consecutive memory
/// access that can be widened.
bool LoopVectorizationCostModel::isScalarWithPredication(
Instruction *I, ElementCount VF) const {
- if (!isPredicatedInst(I, VF))
+ if (!isPredicatedInst(I))
return false;
// Do we have a non-scalar lowering for this predicated
}
}
-bool LoopVectorizationCostModel::isPredicatedInst(Instruction *I,
- ElementCount VF) const {
+bool LoopVectorizationCostModel::isPredicatedInst(Instruction *I) const {
if (!blockNeedsPredicationForAnyReason(I->getParent()))
return false;
// from moving "masked load/store" check from legality to cost model.
// Masked Load/Gather emulation was previously never allowed.
// Limited number of Masked Store/Scatter emulation was allowed.
- assert((isPredicatedInst(I, VF)) &&
+ assert((isPredicatedInst(I)) &&
"Expecting a scalar emulated instruction");
return isa<LoadInst>(I) ||
(isa<StoreInst>(I) &&
// If we have a predicated load/store, it will need extra i1 extracts and
// conditional branches, but may not be executed for each vector lane. Scale
// the cost by the probability of executing the predicated block.
- if (isPredicatedInst(I, VF)) {
+ if (isPredicatedInst(I)) {
Cost /= getReciprocalPredBlockProb();
// Add the cost of an i1 extract and a branch
case Instruction::SDiv:
case Instruction::URem:
case Instruction::SRem:
- if (VF.isVector() && blockNeedsPredicationForAnyReason(I->getParent()) &&
- !isSafeToSpeculativelyExecute(I)) {
+ if (VF.isVector() && isPredicatedInst(I)) {
// If we're speculating lanes, we have two options - scalarization and
// guarded widening.
if (isScalarWithPredication(I, VF)) {
case Instruction::URem: {
// If not provably safe, use a select to form a safe divisor before widening the
// div/rem operation itself. Otherwise fall through to general handling below.
- if (CM.blockNeedsPredicationForAnyReason(I->getParent()) &&
- !isSafeToSpeculativelyExecute(I)) {
+ if (CM.isPredicatedInst(I)) {
SmallVector<VPValue *> Ops(Operands.begin(), Operands.end());
VPValue *Mask = createBlockInMask(I->getParent(), Plan);
VPValue *One =
[&](ElementCount VF) { return CM.isUniformAfterVectorization(I, VF); },
Range);
- bool IsPredicated = LoopVectorizationPlanner::getDecisionAndClampRange(
- [&](ElementCount VF) { return CM.isPredicatedInst(I, VF); },
- Range);
+ bool IsPredicated = CM.isPredicatedInst(I);
// Even if the instruction is not marked as uniform, there are certain
// intrinsic calls that can be effectively treated as such, so we check for