Skip to content

Commit eab4460

Browse files
authored
[VPlan] Rename onlyFirst(Lane|Part)Used (NFC) (llvm#166562)
Rename onlyFirst(Lane|Part)Used to usesFirst(Lane|Part)Only, in line with usesScalars, for clarity.
1 parent fc179af commit eab4460

File tree

6 files changed

+42
-42
lines changed

6 files changed

+42
-42
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,10 +1163,10 @@ class LLVM_ABI_FOR_TEST VPInstruction : public VPRecipeWithIRFlags,
11631163
bool opcodeMayReadOrWriteFromMemory() const;
11641164

11651165
/// Returns true if the recipe only uses the first lane of operand \p Op.
1166-
bool onlyFirstLaneUsed(const VPValue *Op) const override;
1166+
bool usesFirstLaneOnly(const VPValue *Op) const override;
11671167

11681168
/// Returns true if the recipe only uses the first part of operand \p Op.
1169-
bool onlyFirstPartUsed(const VPValue *Op) const override;
1169+
bool usesFirstPartOnly(const VPValue *Op) const override;
11701170

11711171
/// Returns true if this VPInstruction produces a scalar value from a vector,
11721172
/// e.g. by performing a reduction or extracting a lane.
@@ -1393,13 +1393,13 @@ class VPIRInstruction : public VPRecipeBase {
13931393
return true;
13941394
}
13951395

1396-
bool onlyFirstPartUsed(const VPValue *Op) const override {
1396+
bool usesFirstPartOnly(const VPValue *Op) const override {
13971397
assert(is_contained(operands(), Op) &&
13981398
"Op must be an operand of the recipe");
13991399
return true;
14001400
}
14011401

1402-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
1402+
bool usesFirstLaneOnly(const VPValue *Op) const override {
14031403
assert(is_contained(operands(), Op) &&
14041404
"Op must be an operand of the recipe");
14051405
return true;
@@ -1628,7 +1628,7 @@ class VPWidenIntrinsicRecipe : public VPRecipeWithIRFlags, public VPIRMetadata {
16281628
VPSlotTracker &SlotTracker) const override;
16291629
#endif
16301630

1631-
bool onlyFirstLaneUsed(const VPValue *Op) const override;
1631+
bool usesFirstLaneOnly(const VPValue *Op) const override;
16321632
};
16331633

16341634
/// A recipe for widening Call instructions using library calls.
@@ -1767,7 +1767,7 @@ struct LLVM_ABI_FOR_TEST VPWidenSelectRecipe : public VPRecipeWithIRFlags,
17671767
}
17681768

17691769
/// Returns true if the recipe only uses the first lane of operand \p Op.
1770-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
1770+
bool usesFirstLaneOnly(const VPValue *Op) const override {
17711771
assert(is_contained(operands(), Op) &&
17721772
"Op must be an operand of the recipe");
17731773
return Op == getCond() && isInvariantCond();
@@ -1833,7 +1833,7 @@ class LLVM_ABI_FOR_TEST VPWidenGEPRecipe : public VPRecipeWithIRFlags {
18331833
#endif
18341834

18351835
/// Returns true if the recipe only uses the first lane of operand \p Op.
1836-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
1836+
bool usesFirstLaneOnly(const VPValue *Op) const override {
18371837
assert(is_contained(operands(), Op) &&
18381838
"Op must be an operand of the recipe");
18391839
if (Op == getOperand(0))
@@ -1870,7 +1870,7 @@ class VPVectorEndPointerRecipe : public VPRecipeWithIRFlags,
18701870

18711871
void execute(VPTransformState &State) override;
18721872

1873-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
1873+
bool usesFirstLaneOnly(const VPValue *Op) const override {
18741874
assert(is_contained(operands(), Op) &&
18751875
"Op must be an operand of the recipe");
18761876
return true;
@@ -1884,7 +1884,7 @@ class VPVectorEndPointerRecipe : public VPRecipeWithIRFlags,
18841884
}
18851885

18861886
/// Returns true if the recipe only uses the first part of operand \p Op.
1887-
bool onlyFirstPartUsed(const VPValue *Op) const override {
1887+
bool usesFirstPartOnly(const VPValue *Op) const override {
18881888
assert(is_contained(operands(), Op) &&
18891889
"Op must be an operand of the recipe");
18901890
assert(getNumOperands() <= 2 && "must have at most two operands");
@@ -1922,14 +1922,14 @@ class VPVectorPointerRecipe : public VPRecipeWithIRFlags,
19221922

19231923
Type *getSourceElementType() const { return SourceElementTy; }
19241924

1925-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
1925+
bool usesFirstLaneOnly(const VPValue *Op) const override {
19261926
assert(is_contained(operands(), Op) &&
19271927
"Op must be an operand of the recipe");
19281928
return true;
19291929
}
19301930

19311931
/// Returns true if the recipe only uses the first part of operand \p Op.
1932-
bool onlyFirstPartUsed(const VPValue *Op) const override {
1932+
bool usesFirstPartOnly(const VPValue *Op) const override {
19331933
assert(is_contained(operands(), Op) &&
19341934
"Op must be an operand of the recipe");
19351935
assert(getNumOperands() <= 2 && "must have at most two operands");
@@ -2110,7 +2110,7 @@ class VPWidenInductionRecipe : public VPHeaderPHIRecipe {
21102110
}
21112111

21122112
/// Returns true if the recipe only uses the first lane of operand \p Op.
2113-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
2113+
bool usesFirstLaneOnly(const VPValue *Op) const override {
21142114
assert(is_contained(operands(), Op) &&
21152115
"Op must be an operand of the recipe");
21162116
// The recipe creates its own wide start value, so it only requests the
@@ -2325,7 +2325,7 @@ struct VPFirstOrderRecurrencePHIRecipe : public VPHeaderPHIRecipe {
23252325
#endif
23262326

23272327
/// Returns true if the recipe only uses the first lane of operand \p Op.
2328-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
2328+
bool usesFirstLaneOnly(const VPValue *Op) const override {
23292329
assert(is_contained(operands(), Op) &&
23302330
"Op must be an operand of the recipe");
23312331
return Op == getStartValue();
@@ -2399,7 +2399,7 @@ class VPReductionPHIRecipe : public VPHeaderPHIRecipe,
23992399
bool isInLoop() const { return IsInLoop; }
24002400

24012401
/// Returns true if the recipe only uses the first lane of operand \p Op.
2402-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
2402+
bool usesFirstLaneOnly(const VPValue *Op) const override {
24032403
assert(is_contained(operands(), Op) &&
24042404
"Op must be an operand of the recipe");
24052405
return isOrdered() || isInLoop();
@@ -2468,13 +2468,13 @@ class LLVM_ABI_FOR_TEST VPBlendRecipe : public VPSingleDefRecipe {
24682468
#endif
24692469

24702470
/// Returns true if the recipe only uses the first lane of operand \p Op.
2471-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
2471+
bool usesFirstLaneOnly(const VPValue *Op) const override {
24722472
assert(is_contained(operands(), Op) &&
24732473
"Op must be an operand of the recipe");
24742474
// Recursing through Blend recipes only, must terminate at header phi's the
24752475
// latest.
24762476
return all_of(users(),
2477-
[this](VPUser *U) { return U->onlyFirstLaneUsed(this); });
2477+
[this](VPUser *U) { return U->usesFirstLaneOnly(this); });
24782478
}
24792479
};
24802480

@@ -2562,7 +2562,7 @@ class LLVM_ABI_FOR_TEST VPInterleaveBase : public VPRecipeBase,
25622562
VPCostContext &Ctx) const override;
25632563

25642564
/// Returns true if the recipe only uses the first lane of operand \p Op.
2565-
bool onlyFirstLaneUsed(const VPValue *Op) const override = 0;
2565+
bool usesFirstLaneOnly(const VPValue *Op) const override = 0;
25662566

25672567
/// Returns the number of stored operands of this interleave group. Returns 0
25682568
/// for load interleave groups.
@@ -2608,7 +2608,7 @@ class LLVM_ABI_FOR_TEST VPInterleaveRecipe final : public VPInterleaveBase {
26082608
VPSlotTracker &SlotTracker) const override;
26092609
#endif
26102610

2611-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
2611+
bool usesFirstLaneOnly(const VPValue *Op) const override {
26122612
assert(is_contained(operands(), Op) &&
26132613
"Op must be an operand of the recipe");
26142614
return Op == getAddr() && !llvm::is_contained(getStoredValues(), Op);
@@ -2656,7 +2656,7 @@ class LLVM_ABI_FOR_TEST VPInterleaveEVLRecipe final : public VPInterleaveBase {
26562656
#endif
26572657

26582658
/// The recipe only uses the first lane of the address, and EVL operand.
2659-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
2659+
bool usesFirstLaneOnly(const VPValue *Op) const override {
26602660
assert(is_contained(operands(), Op) &&
26612661
"Op must be an operand of the recipe");
26622662
return (Op == getAddr() && !llvm::is_contained(getStoredValues(), Op)) ||
@@ -2862,7 +2862,7 @@ class LLVM_ABI_FOR_TEST VPReductionEVLRecipe : public VPReductionRecipe {
28622862
VPValue *getEVL() const { return getOperand(2); }
28632863

28642864
/// Returns true if the recipe only uses the first lane of operand \p Op.
2865-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
2865+
bool usesFirstLaneOnly(const VPValue *Op) const override {
28662866
assert(is_contained(operands(), Op) &&
28672867
"Op must be an operand of the recipe");
28682868
return Op == getEVL();
@@ -2924,7 +2924,7 @@ class LLVM_ABI_FOR_TEST VPReplicateRecipe : public VPRecipeWithIRFlags,
29242924
bool isPredicated() const { return IsPredicated; }
29252925

29262926
/// Returns true if the recipe only uses the first lane of operand \p Op.
2927-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
2927+
bool usesFirstLaneOnly(const VPValue *Op) const override {
29282928
assert(is_contained(operands(), Op) &&
29292929
"Op must be an operand of the recipe");
29302930
return isSingleScalar();
@@ -3300,7 +3300,7 @@ struct LLVM_ABI_FOR_TEST VPWidenLoadRecipe final : public VPWidenMemoryRecipe,
33003300
#endif
33013301

33023302
/// Returns true if the recipe only uses the first lane of operand \p Op.
3303-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
3303+
bool usesFirstLaneOnly(const VPValue *Op) const override {
33043304
assert(is_contained(operands(), Op) &&
33053305
"Op must be an operand of the recipe");
33063306
// Widened, consecutive loads operations only demand the first lane of
@@ -3341,7 +3341,7 @@ struct VPWidenLoadEVLRecipe final : public VPWidenMemoryRecipe, public VPValue {
33413341
#endif
33423342

33433343
/// Returns true if the recipe only uses the first lane of operand \p Op.
3344-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
3344+
bool usesFirstLaneOnly(const VPValue *Op) const override {
33453345
assert(is_contained(operands(), Op) &&
33463346
"Op must be an operand of the recipe");
33473347
// Widened loads only demand the first lane of EVL and consecutive loads
@@ -3382,7 +3382,7 @@ struct LLVM_ABI_FOR_TEST VPWidenStoreRecipe final : public VPWidenMemoryRecipe {
33823382
#endif
33833383

33843384
/// Returns true if the recipe only uses the first lane of operand \p Op.
3385-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
3385+
bool usesFirstLaneOnly(const VPValue *Op) const override {
33863386
assert(is_contained(operands(), Op) &&
33873387
"Op must be an operand of the recipe");
33883388
// Widened, consecutive stores only demand the first lane of their address,
@@ -3425,7 +3425,7 @@ struct VPWidenStoreEVLRecipe final : public VPWidenMemoryRecipe {
34253425
#endif
34263426

34273427
/// Returns true if the recipe only uses the first lane of operand \p Op.
3428-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
3428+
bool usesFirstLaneOnly(const VPValue *Op) const override {
34293429
assert(is_contained(operands(), Op) &&
34303430
"Op must be an operand of the recipe");
34313431
if (Op == getEVL()) {
@@ -3509,14 +3509,14 @@ class VPCanonicalIVPHIRecipe : public VPHeaderPHIRecipe {
35093509
}
35103510

35113511
/// Returns true if the recipe only uses the first lane of operand \p Op.
3512-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
3512+
bool usesFirstLaneOnly(const VPValue *Op) const override {
35133513
assert(is_contained(operands(), Op) &&
35143514
"Op must be an operand of the recipe");
35153515
return true;
35163516
}
35173517

35183518
/// Returns true if the recipe only uses the first part of operand \p Op.
3519-
bool onlyFirstPartUsed(const VPValue *Op) const override {
3519+
bool usesFirstPartOnly(const VPValue *Op) const override {
35203520
assert(is_contained(operands(), Op) &&
35213521
"Op must be an operand of the recipe");
35223522
return true;
@@ -3591,7 +3591,7 @@ class VPEVLBasedIVPHIRecipe : public VPHeaderPHIRecipe {
35913591
}
35923592

35933593
/// Returns true if the recipe only uses the first lane of operand \p Op.
3594-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
3594+
bool usesFirstLaneOnly(const VPValue *Op) const override {
35953595
assert(is_contained(operands(), Op) &&
35963596
"Op must be an operand of the recipe");
35973597
return true;
@@ -3701,7 +3701,7 @@ class VPDerivedIVRecipe : public VPSingleDefRecipe {
37013701
VPValue *getStepValue() const { return getOperand(2); }
37023702

37033703
/// Returns true if the recipe only uses the first lane of operand \p Op.
3704-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
3704+
bool usesFirstLaneOnly(const VPValue *Op) const override {
37053705
assert(is_contained(operands(), Op) &&
37063706
"Op must be an operand of the recipe");
37073707
return true;
@@ -3766,7 +3766,7 @@ class LLVM_ABI_FOR_TEST VPScalarIVStepsRecipe : public VPRecipeWithIRFlags,
37663766
VPValue *getStepValue() const { return getOperand(1); }
37673767

37683768
/// Returns true if the recipe only uses the first lane of operand \p Op.
3769-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
3769+
bool usesFirstLaneOnly(const VPValue *Op) const override {
37703770
assert(is_contained(operands(), Op) &&
37713771
"Op must be an operand of the recipe");
37723772
return true;

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,7 +1276,7 @@ bool VPInstruction::opcodeMayReadOrWriteFromMemory() const {
12761276
}
12771277
}
12781278

1279-
bool VPInstruction::onlyFirstLaneUsed(const VPValue *Op) const {
1279+
bool VPInstruction::usesFirstLaneOnly(const VPValue *Op) const {
12801280
assert(is_contained(operands(), Op) && "Op must be an operand of the recipe");
12811281
if (Instruction::isBinaryOp(getOpcode()) || Instruction::isCast(getOpcode()))
12821282
return vputils::onlyFirstLaneUsed(this);
@@ -1325,7 +1325,7 @@ bool VPInstruction::onlyFirstLaneUsed(const VPValue *Op) const {
13251325
llvm_unreachable("switch should return");
13261326
}
13271327

1328-
bool VPInstruction::onlyFirstPartUsed(const VPValue *Op) const {
1328+
bool VPInstruction::usesFirstPartOnly(const VPValue *Op) const {
13291329
assert(is_contained(operands(), Op) && "Op must be an operand of the recipe");
13301330
if (Instruction::isBinaryOp(getOpcode()))
13311331
return vputils::onlyFirstPartUsed(this);
@@ -1692,7 +1692,7 @@ void VPWidenCallRecipe::execute(VPTransformState &State) {
16921692
if (!VFTy->getParamType(I.index())->isVectorTy())
16931693
Arg = State.get(I.value(), VPLane(0));
16941694
else
1695-
Arg = State.get(I.value(), onlyFirstLaneUsed(I.value()));
1695+
Arg = State.get(I.value(), usesFirstLaneOnly(I.value()));
16961696
Args.push_back(Arg);
16971697
}
16981698

@@ -1761,7 +1761,7 @@ void VPWidenIntrinsicRecipe::execute(VPTransformState &State) {
17611761
State.TTI))
17621762
Arg = State.get(I.value(), VPLane(0));
17631763
else
1764-
Arg = State.get(I.value(), onlyFirstLaneUsed(I.value()));
1764+
Arg = State.get(I.value(), usesFirstLaneOnly(I.value()));
17651765
if (isVectorIntrinsicWithOverloadTypeAtArg(VectorIntrinsicID, I.index(),
17661766
State.TTI))
17671767
TysForDecl.push_back(Arg->getType());
@@ -1843,7 +1843,7 @@ StringRef VPWidenIntrinsicRecipe::getIntrinsicName() const {
18431843
return Intrinsic::getBaseName(VectorIntrinsicID);
18441844
}
18451845

1846-
bool VPWidenIntrinsicRecipe::onlyFirstLaneUsed(const VPValue *Op) const {
1846+
bool VPWidenIntrinsicRecipe::usesFirstLaneOnly(const VPValue *Op) const {
18471847
assert(is_contained(operands(), Op) && "Op must be an operand of the recipe");
18481848
return all_of(enumerate(operands()), [this, &Op](const auto &X) {
18491849
auto [Idx, V] = X;

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ static bool sinkScalarOperands(VPlan &Plan) {
204204
return cast<VPRecipeBase>(U)->getParent() != SinkTo;
205205
});
206206
if (any_of(UsersOutsideSinkTo, [SinkCandidate](VPUser *U) {
207-
return !U->onlyFirstLaneUsed(SinkCandidate);
207+
return !U->usesFirstLaneOnly(SinkCandidate);
208208
}))
209209
continue;
210210
bool NeedsDuplicating = !UsersOutsideSinkTo.empty();

llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ void VPlanTransforms::replicateByVF(VPlan &Plan, ElementCount VF) {
582582
/// Users that only demand the first lane can use the definition for lane
583583
/// 0.
584584
DefR->replaceUsesWithIf(LaneDefs[0], [DefR](VPUser &U, unsigned) {
585-
return U.onlyFirstLaneUsed(DefR);
585+
return U.usesFirstLaneOnly(DefR);
586586
});
587587

588588
// Update each build vector user that currently has DefR as its only

llvm/lib/Transforms/Vectorize/VPlanUtils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ using namespace llvm::VPlanPatternMatch;
1818

1919
bool vputils::onlyFirstLaneUsed(const VPValue *Def) {
2020
return all_of(Def->users(),
21-
[Def](const VPUser *U) { return U->onlyFirstLaneUsed(Def); });
21+
[Def](const VPUser *U) { return U->usesFirstLaneOnly(Def); });
2222
}
2323

2424
bool vputils::onlyFirstPartUsed(const VPValue *Def) {
2525
return all_of(Def->users(),
26-
[Def](const VPUser *U) { return U->onlyFirstPartUsed(Def); });
26+
[Def](const VPUser *U) { return U->usesFirstPartOnly(Def); });
2727
}
2828

2929
bool vputils::onlyScalarValuesUsed(const VPValue *Def) {

llvm/lib/Transforms/Vectorize/VPlanValue.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,20 +274,20 @@ class VPUser {
274274
virtual bool usesScalars(const VPValue *Op) const {
275275
assert(is_contained(operands(), Op) &&
276276
"Op must be an operand of the recipe");
277-
return onlyFirstLaneUsed(Op);
277+
return usesFirstLaneOnly(Op);
278278
}
279279

280280
/// Returns true if the VPUser only uses the first lane of operand \p Op.
281281
/// Conservatively returns false.
282-
virtual bool onlyFirstLaneUsed(const VPValue *Op) const {
282+
virtual bool usesFirstLaneOnly(const VPValue *Op) const {
283283
assert(is_contained(operands(), Op) &&
284284
"Op must be an operand of the recipe");
285285
return false;
286286
}
287287

288288
/// Returns true if the VPUser only uses the first part of operand \p Op.
289289
/// Conservatively returns false.
290-
virtual bool onlyFirstPartUsed(const VPValue *Op) const {
290+
virtual bool usesFirstPartOnly(const VPValue *Op) const {
291291
assert(is_contained(operands(), Op) &&
292292
"Op must be an operand of the recipe");
293293
return false;

0 commit comments

Comments
 (0)