Skip to content

Commit ff9cac1

Browse files
committed
[VPlan] DerivedIV name
1 parent 33a7117 commit ff9cac1

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,9 @@ class VPBuilder {
234234
VPDerivedIVRecipe *createDerivedIV(InductionDescriptor::InductionKind Kind,
235235
FPMathOperator *FPBinOp, VPValue *Start,
236236
VPCanonicalIVPHIRecipe *CanonicalIV,
237-
VPValue *Step) {
237+
VPValue *Step, const Twine &Name = "") {
238238
return tryInsertInstruction(
239-
new VPDerivedIVRecipe(Kind, FPBinOp, Start, CanonicalIV, Step));
239+
new VPDerivedIVRecipe(Kind, FPBinOp, Start, CanonicalIV, Step, Name));
240240
}
241241

242242
VPScalarCastRecipe *createScalarCast(Instruction::CastOps Opcode, VPValue *Op,

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9556,7 +9556,7 @@ void VPDerivedIVRecipe::execute(VPTransformState &State) {
95569556
Value *DerivedIV = emitTransformedIndex(
95579557
State.Builder, CanonicalIV, getStartValue()->getLiveInIRValue(), Step,
95589558
Kind, cast_if_present<BinaryOperator>(FPBinOp));
9559-
DerivedIV->setName("offset.idx");
9559+
DerivedIV->setName(Name);
95609560
assert(DerivedIV != CanonicalIV && "IV didn't need transforming?");
95619561

95629562
State.set(this, DerivedIV, VPLane(0));

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3160,19 +3160,21 @@ class VPDerivedIVRecipe : public VPSingleDefRecipe {
31603160
/// for floating point inductions.
31613161
const FPMathOperator *FPBinOp;
31623162

3163+
std::string Name;
3164+
31633165
public:
31643166
VPDerivedIVRecipe(const InductionDescriptor &IndDesc, VPValue *Start,
3165-
VPCanonicalIVPHIRecipe *CanonicalIV, VPValue *Step)
3167+
VPCanonicalIVPHIRecipe *CanonicalIV, VPValue *Step, const Twine &Name = "")
31663168
: VPDerivedIVRecipe(
31673169
IndDesc.getKind(),
31683170
dyn_cast_or_null<FPMathOperator>(IndDesc.getInductionBinOp()),
3169-
Start, CanonicalIV, Step) {}
3171+
Start, CanonicalIV, Step, Name) {}
31703172

31713173
VPDerivedIVRecipe(InductionDescriptor::InductionKind Kind,
31723174
const FPMathOperator *FPBinOp, VPValue *Start, VPValue *IV,
3173-
VPValue *Step)
3175+
VPValue *Step, const Twine &Name = "")
31743176
: VPSingleDefRecipe(VPDef::VPDerivedIVSC, {Start, IV, Step}), Kind(Kind),
3175-
FPBinOp(FPBinOp) {}
3177+
FPBinOp(FPBinOp), Name(Name.str()) {}
31763178

31773179
~VPDerivedIVRecipe() override = default;
31783180

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,8 @@ createScalarIVSteps(VPlan &Plan, InductionDescriptor::InductionKind Kind,
534534
VPCanonicalIVPHIRecipe *CanonicalIV = Plan.getCanonicalIV();
535535
VPSingleDefRecipe *BaseIV = CanonicalIV;
536536
if (!CanonicalIV->isCanonical(Kind, StartV, Step)) {
537-
BaseIV = Builder.createDerivedIV(Kind, FPBinOp, StartV, CanonicalIV, Step);
537+
BaseIV = Builder.createDerivedIV(Kind, FPBinOp, StartV, CanonicalIV, Step, "offset.idx"
538+
);
538539
}
539540

540541
// Truncate base induction if needed.

0 commit comments

Comments
 (0)