Skip to content

Commit 71a1db6

Browse files
committed
[VPlan] DerivedIV name
1 parent 555c93e commit 71a1db6

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
@@ -9589,7 +9589,7 @@ void VPDerivedIVRecipe::execute(VPTransformState &State) {
95899589
Value *DerivedIV = emitTransformedIndex(
95909590
State.Builder, CanonicalIV, getStartValue()->getLiveInIRValue(), Step,
95919591
Kind, cast_if_present<BinaryOperator>(FPBinOp));
9592-
DerivedIV->setName("offset.idx");
9592+
DerivedIV->setName(Name);
95939593
assert(DerivedIV != CanonicalIV && "IV didn't need transforming?");
95949594

95959595
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
@@ -3299,19 +3299,21 @@ class VPDerivedIVRecipe : public VPSingleDefRecipe {
32993299
/// for floating point inductions.
33003300
const FPMathOperator *FPBinOp;
33013301

3302+
std::string Name;
3303+
33023304
public:
33033305
VPDerivedIVRecipe(const InductionDescriptor &IndDesc, VPValue *Start,
3304-
VPCanonicalIVPHIRecipe *CanonicalIV, VPValue *Step)
3306+
VPCanonicalIVPHIRecipe *CanonicalIV, VPValue *Step, const Twine &Name = "")
33053307
: VPDerivedIVRecipe(
33063308
IndDesc.getKind(),
33073309
dyn_cast_or_null<FPMathOperator>(IndDesc.getInductionBinOp()),
3308-
Start, CanonicalIV, Step) {}
3310+
Start, CanonicalIV, Step, Name) {}
33093311

33103312
VPDerivedIVRecipe(InductionDescriptor::InductionKind Kind,
33113313
const FPMathOperator *FPBinOp, VPValue *Start, VPValue *IV,
3312-
VPValue *Step)
3314+
VPValue *Step, const Twine &Name = "")
33133315
: VPSingleDefRecipe(VPDef::VPDerivedIVSC, {Start, IV, Step}), Kind(Kind),
3314-
FPBinOp(FPBinOp) {}
3316+
FPBinOp(FPBinOp), Name(Name.str()) {}
33153317

33163318
~VPDerivedIVRecipe() override = default;
33173319

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,8 @@ createScalarIVSteps(VPlan &Plan, InductionDescriptor::InductionKind Kind,
528528
VPCanonicalIVPHIRecipe *CanonicalIV = Plan.getCanonicalIV();
529529
VPSingleDefRecipe *BaseIV = CanonicalIV;
530530
if (!CanonicalIV->isCanonical(Kind, StartV, Step)) {
531-
BaseIV = Builder.createDerivedIV(Kind, FPBinOp, StartV, CanonicalIV, Step);
531+
BaseIV = Builder.createDerivedIV(Kind, FPBinOp, StartV, CanonicalIV, Step, "offset.idx"
532+
);
532533
}
533534

534535
// Truncate base induction if needed.

0 commit comments

Comments
 (0)