Skip to content

Commit a5062fd

Browse files
committed
[VPlan] DerivedIV name
1 parent f1e88a8 commit a5062fd

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
@@ -9622,7 +9622,7 @@ void VPDerivedIVRecipe::execute(VPTransformState &State) {
96229622
Value *DerivedIV = emitTransformedIndex(
96239623
State.Builder, CanonicalIV, getStartValue()->getLiveInIRValue(), Step,
96249624
Kind, cast_if_present<BinaryOperator>(FPBinOp));
9625-
DerivedIV->setName("offset.idx");
9625+
DerivedIV->setName(Name);
96269626
assert(DerivedIV != CanonicalIV && "IV didn't need transforming?");
96279627

96289628
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
@@ -3301,19 +3301,21 @@ class VPDerivedIVRecipe : public VPSingleDefRecipe {
33013301
/// for floating point inductions.
33023302
const FPMathOperator *FPBinOp;
33033303

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

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

33183320
~VPDerivedIVRecipe() override = default;
33193321

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)