Skip to content

Commit 8a71ea7

Browse files
committed
!fixup remove extra args from isPredicatedInst
1 parent 2c8de7c commit 8a71ea7

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,8 +1410,7 @@ class LoopVectorizationCostModel {
14101410
/// Returns true if \p I is an instruction that needs to be predicated
14111411
/// at runtime. The result is independent of the predication mechanism.
14121412
/// Superset of instructions that return true for isScalarWithPredication.
1413-
bool isPredicatedInst(Instruction *I, ElementCount VF,
1414-
bool IsKnownUniform = false) const;
1413+
bool isPredicatedInst(Instruction *I) const;
14151414

14161415
/// Return the costs for our two available strategies for lowering a
14171416
/// div/rem operation which requires speculating at least one lane.
@@ -3650,7 +3649,7 @@ void LoopVectorizationCostModel::collectLoopScalars(ElementCount VF) {
36503649

36513650
bool LoopVectorizationCostModel::isScalarWithPredication(
36523651
Instruction *I, ElementCount VF) const {
3653-
if (!isPredicatedInst(I, VF))
3652+
if (!isPredicatedInst(I))
36543653
return false;
36553654

36563655
// Do we have a non-scalar lowering for this predicated
@@ -3689,9 +3688,7 @@ bool LoopVectorizationCostModel::isScalarWithPredication(
36893688
}
36903689
}
36913690

3692-
bool LoopVectorizationCostModel::isPredicatedInst(Instruction *I,
3693-
ElementCount VF,
3694-
bool IsKnownUniform) const {
3691+
bool LoopVectorizationCostModel::isPredicatedInst(Instruction *I) const {
36953692
if (!blockNeedsPredicationForAnyReason(I->getParent()))
36963693
return false;
36973694

@@ -3939,7 +3936,7 @@ void LoopVectorizationCostModel::collectLoopUniforms(ElementCount VF) {
39393936
<< *I << "\n");
39403937
return;
39413938
}
3942-
if (isPredicatedInst(I, VF, true)) {
3939+
if (isPredicatedInst(I)) {
39433940
LLVM_DEBUG(
39443941
dbgs() << "LV: Found not uniform due to requiring predication: " << *I
39453942
<< "\n");
@@ -5674,7 +5671,7 @@ bool LoopVectorizationCostModel::useEmulatedMaskMemRefHack(Instruction *I,
56745671
// from moving "masked load/store" check from legality to cost model.
56755672
// Masked Load/Gather emulation was previously never allowed.
56765673
// Limited number of Masked Store/Scatter emulation was allowed.
5677-
assert((isPredicatedInst(I, VF)) &&
5674+
assert((isPredicatedInst(I)) &&
56785675
"Expecting a scalar emulated instruction");
56795676
return isa<LoadInst>(I) ||
56805677
(isa<StoreInst>(I) &&
@@ -5953,7 +5950,7 @@ LoopVectorizationCostModel::getMemInstScalarizationCost(Instruction *I,
59535950
// If we have a predicated load/store, it will need extra i1 extracts and
59545951
// conditional branches, but may not be executed for each vector lane. Scale
59555952
// the cost by the probability of executing the predicated block.
5956-
if (isPredicatedInst(I, VF)) {
5953+
if (isPredicatedInst(I)) {
59575954
Cost /= getReciprocalPredBlockProb();
59585955

59595956
// Add the cost of an i1 extract and a branch
@@ -6813,7 +6810,7 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
68136810
case Instruction::SDiv:
68146811
case Instruction::URem:
68156812
case Instruction::SRem:
6816-
if (VF.isVector() && isPredicatedInst(I, VF)) {
6813+
if (VF.isVector() && isPredicatedInst(I)) {
68176814
const auto [ScalarCost, SafeDivisorCost] = getDivRemSpeculationCost(I, VF);
68186815
return isDivRemScalarWithPredication(ScalarCost, SafeDivisorCost) ?
68196816
ScalarCost : SafeDivisorCost;
@@ -8485,7 +8482,7 @@ bool VPRecipeBuilder::shouldWiden(Instruction *I, VFRange &Range) const {
84858482

84868483
VPWidenRecipe *VPRecipeBuilder::tryToWiden(Instruction *I,
84878484
ArrayRef<VPValue *> Operands,
8488-
VPBasicBlock *VPBB, VFRange &Range) {
8485+
VPBasicBlock *VPBB) {
84898486
switch (I->getOpcode()) {
84908487
default:
84918488
return nullptr;
@@ -8495,10 +8492,7 @@ VPWidenRecipe *VPRecipeBuilder::tryToWiden(Instruction *I,
84958492
case Instruction::URem: {
84968493
// If not provably safe, use a select to form a safe divisor before widening the
84978494
// div/rem operation itself. Otherwise fall through to general handling below.
8498-
bool IsPredicated = LoopVectorizationPlanner::getDecisionAndClampRange(
8499-
[&](ElementCount VF) -> bool { return CM.isPredicatedInst(I, VF); },
8500-
Range);
8501-
if (IsPredicated) {
8495+
if (CM.isPredicatedInst(I)) {
85028496
SmallVector<VPValue *> Ops(Operands.begin(), Operands.end());
85038497
VPValue *Mask = getBlockInMask(I->getParent());
85048498
VPValue *One =
@@ -8548,8 +8542,8 @@ VPReplicateRecipe *VPRecipeBuilder::handleReplication(Instruction *I,
85488542
[&](ElementCount VF) { return CM.isUniformAfterVectorization(I, VF); },
85498543
Range);
85508544

8551-
bool IsPredicated = LoopVectorizationPlanner::getDecisionAndClampRange(
8552-
[&](ElementCount VF) { return CM.isPredicatedInst(I, VF); }, Range);
8545+
bool IsPredicated = CM.isPredicatedInst(I);
8546+
85538547
// Even if the instruction is not marked as uniform, there are certain
85548548
// intrinsic calls that can be effectively treated as such, so we check for
85558549
// them here. Conservatively, we only do this for scalable vectors, since
@@ -8675,7 +8669,7 @@ VPRecipeBuilder::tryToCreateWidenRecipe(Instruction *Instr,
86758669
*CI);
86768670
}
86778671

8678-
return tryToWiden(Instr, Operands, VPBB, Range);
8672+
return tryToWiden(Instr, Operands, VPBB);
86798673
}
86808674

86818675
void LoopVectorizationPlanner::buildVPlansWithVPRecipes(ElementCount MinVF,

llvm/lib/Transforms/Vectorize/VPRecipeBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class VPRecipeBuilder {
100100
/// if it can. The function should only be called if the cost-model indicates
101101
/// that widening should be performed.
102102
VPWidenRecipe *tryToWiden(Instruction *I, ArrayRef<VPValue *> Operands,
103-
VPBasicBlock *VPBB, VFRange &Range);
103+
VPBasicBlock *VPBB);
104104

105105
public:
106106
VPRecipeBuilder(VPlan &Plan, Loop *OrigLoop, const TargetLibraryInfo *TLI,

0 commit comments

Comments
 (0)