Skip to content

Commit 2561004

Browse files
committed
[VPlan] Rename isDefinedOutside[Vector]Regions -> [Loop] (NFC)
Clarify name of helper, split off from https://github.com/llvm/llvm-project/pull/95842/files#r1765556732.
1 parent f325085 commit 2561004

File tree

6 files changed

+12
-13
lines changed

6 files changed

+12
-13
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9452,9 +9452,8 @@ void VPReplicateRecipe::execute(VPTransformState &State) {
94529452
// If the recipe is uniform across all parts (instead of just per VF), only
94539453
// generate a single instance.
94549454
if ((isa<LoadInst>(UI) || isa<StoreInst>(UI)) &&
9455-
all_of(operands(), [](VPValue *Op) {
9456-
return Op->isDefinedOutsideVectorRegions();
9457-
})) {
9455+
all_of(operands(),
9456+
[](VPValue *Op) { return Op->isDefinedOutsideLoopRegions(); })) {
94589457
State.ILV->scalarizeInstruction(UI, this, VPIteration(0, 0), State);
94599458
if (user_begin() != user_end()) {
94609459
for (unsigned Part = 1; Part < State.UF; ++Part)

llvm/lib/Transforms/Vectorize/VPlan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ Value *VPTransformState::get(VPValue *Def, unsigned Part, bool NeedsScalar) {
271271
return Data.PerPartOutput[Def][Part];
272272

273273
auto GetBroadcastInstrs = [this, Def](Value *V) {
274-
bool SafeToHoist = Def->isDefinedOutsideVectorRegions();
274+
bool SafeToHoist = Def->isDefinedOutsideLoopRegions();
275275
if (VF.isScalar())
276276
return V;
277277
// Place the code for broadcasting invariant variables in the new preheader.

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,23 +1717,23 @@ struct VPWidenSelectRecipe : public VPSingleDefRecipe {
17171717
}
17181718

17191719
bool isInvariantCond() const {
1720-
return getCond()->isDefinedOutsideVectorRegions();
1720+
return getCond()->isDefinedOutsideLoopRegions();
17211721
}
17221722
};
17231723

17241724
/// A recipe for handling GEP instructions.
17251725
class VPWidenGEPRecipe : public VPRecipeWithIRFlags {
17261726
bool isPointerLoopInvariant() const {
1727-
return getOperand(0)->isDefinedOutsideVectorRegions();
1727+
return getOperand(0)->isDefinedOutsideLoopRegions();
17281728
}
17291729

17301730
bool isIndexLoopInvariant(unsigned I) const {
1731-
return getOperand(I + 1)->isDefinedOutsideVectorRegions();
1731+
return getOperand(I + 1)->isDefinedOutsideLoopRegions();
17321732
}
17331733

17341734
bool areAllOperandsInvariant() const {
17351735
return all_of(operands(), [](VPValue *Op) {
1736-
return Op->isDefinedOutsideVectorRegions();
1736+
return Op->isDefinedOutsideLoopRegions();
17371737
});
17381738
}
17391739

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,7 @@ InstructionCost VPWidenRecipe::computeCost(ElementCount VF,
12711271
RHSInfo = Ctx.TTI.getOperandInfo(RHS->getLiveInIRValue());
12721272

12731273
if (RHSInfo.Kind == TargetTransformInfo::OK_AnyValue &&
1274-
getOperand(1)->isDefinedOutsideVectorRegions())
1274+
getOperand(1)->isDefinedOutsideLoopRegions())
12751275
RHSInfo.Kind = TargetTransformInfo::OK_UniformValue;
12761276
Type *VectorTy =
12771277
ToVectorTy(Ctx.Types.inferScalarType(this->getVPSingleValue()), VF);
@@ -2093,7 +2093,7 @@ void VPReplicateRecipe::print(raw_ostream &O, const Twine &Indent,
20932093
/// TODO: Uniformity should be associated with a VPValue and there should be a
20942094
/// generic way to check.
20952095
static bool isUniformAcrossVFsAndUFs(VPScalarCastRecipe *C) {
2096-
return C->isDefinedOutsideVectorRegions() ||
2096+
return C->isDefinedOutsideLoopRegions() ||
20972097
isa<VPDerivedIVRecipe>(C->getOperand(0)) ||
20982098
isa<VPCanonicalIVPHIRecipe>(C->getOperand(0));
20992099
}

llvm/lib/Transforms/Vectorize/VPlanUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const SCEV *getSCEVExprForVPValue(VPValue *V, ScalarEvolution &SE);
3939
inline bool isUniformAfterVectorization(const VPValue *VPV) {
4040
// A value defined outside the vector region must be uniform after
4141
// vectorization inside a vector region.
42-
if (VPV->isDefinedOutsideVectorRegions())
42+
if (VPV->isDefinedOutsideLoopRegions())
4343
return true;
4444
const VPRecipeBase *Def = VPV->getDefiningRecipe();
4545
assert(Def && "Must have definition for value defined inside vector region");

llvm/lib/Transforms/Vectorize/VPlanValue.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ class VPValue {
180180
return getUnderlyingValue();
181181
}
182182

183-
/// Returns true if the VPValue is defined outside any vector regions, i.e. it
183+
/// Returns true if the VPValue is defined outside any loop region, i.e. it
184184
/// is a live-in value.
185185
/// TODO: Also handle recipes defined in pre-header blocks.
186-
bool isDefinedOutsideVectorRegions() const { return !hasDefiningRecipe(); }
186+
bool isDefinedOutsideLoopRegions() const { return !hasDefiningRecipe(); }
187187

188188
// Set \p Val as the underlying Value of this VPValue.
189189
void setUnderlyingValue(Value *Val) {

0 commit comments

Comments
 (0)