[llvm] 2561004 - [VPlan] Rename isDefinedOutside[Vector]Regions -> [Loop] (NFC)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 19 03:22:05 PDT 2024
Author: Florian Hahn
Date: 2024-09-19T11:20:31+01:00
New Revision: 256100489de2d01d21ddd9720aad3993a83864c2
URL: https://github.com/llvm/llvm-project/commit/256100489de2d01d21ddd9720aad3993a83864c2
DIFF: https://github.com/llvm/llvm-project/commit/256100489de2d01d21ddd9720aad3993a83864c2.diff
LOG: [VPlan] Rename isDefinedOutside[Vector]Regions -> [Loop] (NFC)
Clarify name of helper, split off from
https://github.com/llvm/llvm-project/pull/95842/files#r1765556732.
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/lib/Transforms/Vectorize/VPlan.cpp
llvm/lib/Transforms/Vectorize/VPlan.h
llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
llvm/lib/Transforms/Vectorize/VPlanUtils.h
llvm/lib/Transforms/Vectorize/VPlanValue.h
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 5ee8f9db32aac8..107fb38be31969 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -9452,9 +9452,8 @@ void VPReplicateRecipe::execute(VPTransformState &State) {
// If the recipe is uniform across all parts (instead of just per VF), only
// generate a single instance.
if ((isa<LoadInst>(UI) || isa<StoreInst>(UI)) &&
- all_of(operands(), [](VPValue *Op) {
- return Op->isDefinedOutsideVectorRegions();
- })) {
+ all_of(operands(),
+ [](VPValue *Op) { return Op->isDefinedOutsideLoopRegions(); })) {
State.ILV->scalarizeInstruction(UI, this, VPIteration(0, 0), State);
if (user_begin() != user_end()) {
for (unsigned Part = 1; Part < State.UF; ++Part)
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index 2169d78542cbaf..6a6ec363592c32 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -271,7 +271,7 @@ Value *VPTransformState::get(VPValue *Def, unsigned Part, bool NeedsScalar) {
return Data.PerPartOutput[Def][Part];
auto GetBroadcastInstrs = [this, Def](Value *V) {
- bool SafeToHoist = Def->isDefinedOutsideVectorRegions();
+ bool SafeToHoist = Def->isDefinedOutsideLoopRegions();
if (VF.isScalar())
return V;
// Place the code for broadcasting invariant variables in the new preheader.
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index 9b9e710ddc88cb..73d218cdc7ac27 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -1717,23 +1717,23 @@ struct VPWidenSelectRecipe : public VPSingleDefRecipe {
}
bool isInvariantCond() const {
- return getCond()->isDefinedOutsideVectorRegions();
+ return getCond()->isDefinedOutsideLoopRegions();
}
};
/// A recipe for handling GEP instructions.
class VPWidenGEPRecipe : public VPRecipeWithIRFlags {
bool isPointerLoopInvariant() const {
- return getOperand(0)->isDefinedOutsideVectorRegions();
+ return getOperand(0)->isDefinedOutsideLoopRegions();
}
bool isIndexLoopInvariant(unsigned I) const {
- return getOperand(I + 1)->isDefinedOutsideVectorRegions();
+ return getOperand(I + 1)->isDefinedOutsideLoopRegions();
}
bool areAllOperandsInvariant() const {
return all_of(operands(), [](VPValue *Op) {
- return Op->isDefinedOutsideVectorRegions();
+ return Op->isDefinedOutsideLoopRegions();
});
}
diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index c077e2b4eac5f1..81c7d1025e8a0b 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -1271,7 +1271,7 @@ InstructionCost VPWidenRecipe::computeCost(ElementCount VF,
RHSInfo = Ctx.TTI.getOperandInfo(RHS->getLiveInIRValue());
if (RHSInfo.Kind == TargetTransformInfo::OK_AnyValue &&
- getOperand(1)->isDefinedOutsideVectorRegions())
+ getOperand(1)->isDefinedOutsideLoopRegions())
RHSInfo.Kind = TargetTransformInfo::OK_UniformValue;
Type *VectorTy =
ToVectorTy(Ctx.Types.inferScalarType(this->getVPSingleValue()), VF);
@@ -2093,7 +2093,7 @@ void VPReplicateRecipe::print(raw_ostream &O, const Twine &Indent,
/// TODO: Uniformity should be associated with a VPValue and there should be a
/// generic way to check.
static bool isUniformAcrossVFsAndUFs(VPScalarCastRecipe *C) {
- return C->isDefinedOutsideVectorRegions() ||
+ return C->isDefinedOutsideLoopRegions() ||
isa<VPDerivedIVRecipe>(C->getOperand(0)) ||
isa<VPCanonicalIVPHIRecipe>(C->getOperand(0));
}
diff --git a/llvm/lib/Transforms/Vectorize/VPlanUtils.h b/llvm/lib/Transforms/Vectorize/VPlanUtils.h
index 7b5d4300655f5a..cb7a4e443176ad 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanUtils.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanUtils.h
@@ -39,7 +39,7 @@ const SCEV *getSCEVExprForVPValue(VPValue *V, ScalarEvolution &SE);
inline bool isUniformAfterVectorization(const VPValue *VPV) {
// A value defined outside the vector region must be uniform after
// vectorization inside a vector region.
- if (VPV->isDefinedOutsideVectorRegions())
+ if (VPV->isDefinedOutsideLoopRegions())
return true;
const VPRecipeBase *Def = VPV->getDefiningRecipe();
assert(Def && "Must have definition for value defined inside vector region");
diff --git a/llvm/lib/Transforms/Vectorize/VPlanValue.h b/llvm/lib/Transforms/Vectorize/VPlanValue.h
index 1dd8d09ff62472..a47ce61e28c50b 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanValue.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanValue.h
@@ -180,10 +180,10 @@ class VPValue {
return getUnderlyingValue();
}
- /// Returns true if the VPValue is defined outside any vector regions, i.e. it
+ /// Returns true if the VPValue is defined outside any loop region, i.e. it
/// is a live-in value.
/// TODO: Also handle recipes defined in pre-header blocks.
- bool isDefinedOutsideVectorRegions() const { return !hasDefiningRecipe(); }
+ bool isDefinedOutsideLoopRegions() const { return !hasDefiningRecipe(); }
// Set \p Val as the underlying Value of this VPValue.
void setUnderlyingValue(Value *Val) {
More information about the llvm-commits
mailing list