Skip to content

Commit 55f56cd

Browse files
committed
[VPlan] Introduce VPValue::hasDefiningRecipe helper (NFC).
This clarifies the intention of code that uses the helper. Suggested by @ayal during review of D136068, thanks!
1 parent aa16689 commit 55f56cd

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9656,7 +9656,7 @@ void VPReplicateRecipe::execute(VPTransformState &State) {
96569656

96579657
// A store of a loop varying value to a loop invariant address only
96589658
// needs only the last copy of the store.
9659-
if (isa<StoreInst>(UI) && !getOperand(1)->getDefiningRecipe()) {
9659+
if (isa<StoreInst>(UI) && !getOperand(1)->hasDefiningRecipe()) {
96609660
auto Lane = VPLane::getLastLaneForVF(State.VF);
96619661
State.ILV->scalarizeInstruction(UI, this, VPIteration(State.UF - 1, Lane), IsPredicated,
96629662
State);

llvm/lib/Transforms/Vectorize/VPlan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ VPBasicBlock::iterator VPBasicBlock::getFirstNonPhi() {
210210
}
211211

212212
Value *VPTransformState::get(VPValue *Def, const VPIteration &Instance) {
213-
if (!Def->getDefiningRecipe())
213+
if (!Def->hasDefiningRecipe())
214214
return Def->getLiveInIRValue();
215215

216216
if (hasScalarValue(Def, Instance)) {

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ bool VPScalarIVStepsRecipe::isCanonical() const {
723723
if (CanIV->getStartValue() != getStartValue())
724724
return false;
725725
auto *StepVPV = getStepValue();
726-
if (StepVPV->getDefiningRecipe())
726+
if (StepVPV->hasDefiningRecipe())
727727
return false;
728728
auto *StepC = dyn_cast_or_null<ConstantInt>(StepVPV->getLiveInIRValue());
729729
return StepC && StepC->isOne();

llvm/lib/Transforms/Vectorize/VPlanValue.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,24 +187,27 @@ class VPValue {
187187
VPRecipeBase *getDefiningRecipe();
188188
const VPRecipeBase *getDefiningRecipe() const;
189189

190+
/// Returns true if this VPValue is defined by a recipe.
191+
bool hasDefiningRecipe() const { return getDefiningRecipe(); }
192+
190193
/// Returns the underlying IR value, if this VPValue is defined outside the
191194
/// scope of VPlan. Returns nullptr if the VPValue is defined by a VPDef
192195
/// inside a VPlan.
193196
Value *getLiveInIRValue() {
194-
assert(!getDefiningRecipe() &&
197+
assert(!hasDefiningRecipe() &&
195198
"VPValue is not a live-in; it is defined by a VPDef inside a VPlan");
196199
return getUnderlyingValue();
197200
}
198201
const Value *getLiveInIRValue() const {
199-
assert(!getDefiningRecipe() &&
202+
assert(!hasDefiningRecipe() &&
200203
"VPValue is not a live-in; it is defined by a VPDef inside a VPlan");
201204
return getUnderlyingValue();
202205
}
203206

204207
/// Returns true if the VPValue is defined outside any vector regions, i.e. it
205208
/// is a live-in value.
206209
/// TODO: Also handle recipes defined in pre-header blocks.
207-
bool isDefinedOutsideVectorRegions() const { return !getDefiningRecipe(); }
210+
bool isDefinedOutsideVectorRegions() const { return !hasDefiningRecipe(); }
208211
};
209212

210213
typedef DenseMap<Value *, VPValue *> Value2VPValueTy;

0 commit comments

Comments
 (0)