@@ -1443,9 +1443,8 @@ class LoopVectorizationCostModel {
1443
1443
1444
1444
// / Returns true if \p I is an instruction that needs to be predicated
1445
1445
// / at runtime. The result is independent of the predication mechanism.
1446
- // / \p VF is the vectorization factor that will be used to vectorize \p I.
1447
1446
// / Superset of instructions that return true for isScalarWithPredication.
1448
- bool isPredicatedInst (Instruction *I, ElementCount VF ) const ;
1447
+ bool isPredicatedInst (Instruction *I) const ;
1449
1448
1450
1449
// / Returns true if \p I is a memory instruction with consecutive memory
1451
1450
// / access that can be widened.
@@ -4412,7 +4411,7 @@ void LoopVectorizationCostModel::collectLoopScalars(ElementCount VF) {
4412
4411
4413
4412
bool LoopVectorizationCostModel::isScalarWithPredication (
4414
4413
Instruction *I, ElementCount VF) const {
4415
- if (!isPredicatedInst (I, VF ))
4414
+ if (!isPredicatedInst (I))
4416
4415
return false ;
4417
4416
4418
4417
// Do we have a non-scalar lowering for this predicated
@@ -4445,8 +4444,7 @@ bool LoopVectorizationCostModel::isScalarWithPredication(
4445
4444
}
4446
4445
}
4447
4446
4448
- bool LoopVectorizationCostModel::isPredicatedInst (Instruction *I,
4449
- ElementCount VF) const {
4447
+ bool LoopVectorizationCostModel::isPredicatedInst (Instruction *I) const {
4450
4448
if (!blockNeedsPredicationForAnyReason (I->getParent ()))
4451
4449
return false ;
4452
4450
@@ -6087,7 +6085,7 @@ bool LoopVectorizationCostModel::useEmulatedMaskMemRefHack(Instruction *I,
6087
6085
// from moving "masked load/store" check from legality to cost model.
6088
6086
// Masked Load/Gather emulation was previously never allowed.
6089
6087
// Limited number of Masked Store/Scatter emulation was allowed.
6090
- assert ((isPredicatedInst (I, VF )) &&
6088
+ assert ((isPredicatedInst (I)) &&
6091
6089
" Expecting a scalar emulated instruction" );
6092
6090
return isa<LoadInst>(I) ||
6093
6091
(isa<StoreInst>(I) &&
@@ -6369,7 +6367,7 @@ LoopVectorizationCostModel::getMemInstScalarizationCost(Instruction *I,
6369
6367
// If we have a predicated load/store, it will need extra i1 extracts and
6370
6368
// conditional branches, but may not be executed for each vector lane. Scale
6371
6369
// the cost by the probability of executing the predicated block.
6372
- if (isPredicatedInst (I, VF )) {
6370
+ if (isPredicatedInst (I)) {
6373
6371
Cost /= getReciprocalPredBlockProb ();
6374
6372
6375
6373
// Add the cost of an i1 extract and a branch
@@ -7068,8 +7066,7 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I, ElementCount VF,
7068
7066
case Instruction::SDiv:
7069
7067
case Instruction::URem:
7070
7068
case Instruction::SRem:
7071
- if (VF.isVector () && blockNeedsPredicationForAnyReason (I->getParent ()) &&
7072
- !isSafeToSpeculativelyExecute (I)) {
7069
+ if (VF.isVector () && isPredicatedInst (I)) {
7073
7070
// If we're speculating lanes, we have two options - scalarization and
7074
7071
// guarded widening.
7075
7072
if (isScalarWithPredication (I, VF)) {
@@ -8371,8 +8368,7 @@ VPRecipeBase *VPRecipeBuilder::tryToWiden(Instruction *I,
8371
8368
case Instruction::URem: {
8372
8369
// If not provably safe, use a select to form a safe divisor before widening the
8373
8370
// div/rem operation itself. Otherwise fall through to general handling below.
8374
- if (CM.blockNeedsPredicationForAnyReason (I->getParent ()) &&
8375
- !isSafeToSpeculativelyExecute (I)) {
8371
+ if (CM.isPredicatedInst (I)) {
8376
8372
SmallVector<VPValue *> Ops (Operands.begin (), Operands.end ());
8377
8373
VPValue *Mask = createBlockInMask (I->getParent (), Plan);
8378
8374
VPValue *One =
@@ -8438,9 +8434,7 @@ VPBasicBlock *VPRecipeBuilder::handleReplication(
8438
8434
[&](ElementCount VF) { return CM.isUniformAfterVectorization (I, VF); },
8439
8435
Range);
8440
8436
8441
- bool IsPredicated = LoopVectorizationPlanner::getDecisionAndClampRange (
8442
- [&](ElementCount VF) { return CM.isPredicatedInst (I, VF); },
8443
- Range);
8437
+ bool IsPredicated = CM.isPredicatedInst (I);
8444
8438
8445
8439
// Even if the instruction is not marked as uniform, there are certain
8446
8440
// intrinsic calls that can be effectively treated as such, so we check for
0 commit comments