Skip to content

Commit 5b7dc5a

Browse files
committed
[VPlan] DerivedIV name
1 parent 33b3aac commit 5b7dc5a

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
@@ -9599,7 +9599,7 @@ void VPDerivedIVRecipe::execute(VPTransformState &State) {
95999599
Value *DerivedIV = emitTransformedIndex(
96009600
State.Builder, CanonicalIV, getStartValue()->getLiveInIRValue(), Step,
96019601
Kind, cast_if_present<BinaryOperator>(FPBinOp));
9602-
DerivedIV->setName("offset.idx");
9602+
DerivedIV->setName(Name);
96039603
assert(DerivedIV != CanonicalIV && "IV didn't need transforming?");
96049604

96059605
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
@@ -3293,19 +3293,21 @@ class VPDerivedIVRecipe : public VPSingleDefRecipe {
32933293
/// for floating point inductions.
32943294
const FPMathOperator *FPBinOp;
32953295

3296+
std::string Name;
3297+
32963298
public:
32973299
VPDerivedIVRecipe(const InductionDescriptor &IndDesc, VPValue *Start,
3298-
VPCanonicalIVPHIRecipe *CanonicalIV, VPValue *Step)
3300+
VPCanonicalIVPHIRecipe *CanonicalIV, VPValue *Step, const Twine &Name = "")
32993301
: VPDerivedIVRecipe(
33003302
IndDesc.getKind(),
33013303
dyn_cast_or_null<FPMathOperator>(IndDesc.getInductionBinOp()),
3302-
Start, CanonicalIV, Step) {}
3304+
Start, CanonicalIV, Step, Name) {}
33033305

33043306
VPDerivedIVRecipe(InductionDescriptor::InductionKind Kind,
33053307
const FPMathOperator *FPBinOp, VPValue *Start, VPValue *IV,
3306-
VPValue *Step)
3308+
VPValue *Step, const Twine &Name = "")
33073309
: VPSingleDefRecipe(VPDef::VPDerivedIVSC, {Start, IV, Step}), Kind(Kind),
3308-
FPBinOp(FPBinOp) {}
3310+
FPBinOp(FPBinOp), Name(Name.str()) {}
33093311

33103312
~VPDerivedIVRecipe() override = default;
33113313

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,8 @@ createScalarIVSteps(VPlan &Plan, InductionDescriptor::InductionKind Kind,
530530
VPCanonicalIVPHIRecipe *CanonicalIV = Plan.getCanonicalIV();
531531
VPSingleDefRecipe *BaseIV = CanonicalIV;
532532
if (!CanonicalIV->isCanonical(Kind, StartV, Step)) {
533-
BaseIV = Builder.createDerivedIV(Kind, FPBinOp, StartV, CanonicalIV, Step);
533+
BaseIV = Builder.createDerivedIV(Kind, FPBinOp, StartV, CanonicalIV, Step, "offset.idx"
534+
);
534535
}
535536

536537
// Truncate base induction if needed.

0 commit comments

Comments
 (0)