Skip to content

Commit 236a0e8

Browse files
committed
[LV] Use VPValue to get expanded value for SCEV step expressions.
Update skeleton creation logic to use SCEV expansion results from expanding the pre-header. This avoids another set of SCEV expansions that may happen after the CFG has been modified. Fixes #58811. Depends on D147964. Reviewed By: Ayal Differential Revision: https://reviews.llvm.org/D147965
1 parent 898a7bd commit 236a0e8

File tree

8 files changed

+269
-65
lines changed

8 files changed

+269
-65
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h

+8-3
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,14 @@ class LoopVectorizationPlanner {
311311
/// TODO: \p IsEpilogueVectorization is needed to avoid issues due to epilogue
312312
/// vectorization re-using plans for both the main and epilogue vector loops.
313313
/// It should be removed once the re-use issue has been fixed.
314-
void executePlan(ElementCount VF, unsigned UF, VPlan &BestPlan,
315-
InnerLoopVectorizer &LB, DominatorTree *DT,
316-
bool IsEpilogueVectorization);
314+
/// Returns a mapping of SCEVs to their expanded IR values. Note that this is
315+
/// a temporary workaround needed due to the current epilogue
316+
/// handling workaround needed due to the current epilogue handling.
317+
DenseMap<const SCEV *, Value *> executePlan(ElementCount VF, unsigned UF,
318+
VPlan &BestPlan,
319+
InnerLoopVectorizer &LB,
320+
DominatorTree *DT,
321+
bool IsEpilogueVectorization);
317322

318323
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
319324
void printPlans(raw_ostream &O);

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

+60-47
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,8 @@ static std::optional<unsigned> getSmallBestKnownTC(ScalarEvolution &SE,
442442
namespace {
443443
// Forward declare GeneratedRTChecks.
444444
class GeneratedRTChecks;
445+
446+
using SCEV2ValueTy = DenseMap<const SCEV *, Value *>;
445447
} // namespace
446448

447449
namespace llvm {
@@ -497,8 +499,10 @@ class InnerLoopVectorizer {
497499
/// loop and the start value for the canonical induction, if it is != 0. The
498500
/// latter is the case when vectorizing the epilogue loop. In the case of
499501
/// epilogue vectorization, this function is overriden to handle the more
500-
/// complex control flow around the loops.
501-
virtual std::pair<BasicBlock *, Value *> createVectorizedLoopSkeleton();
502+
/// complex control flow around the loops. \p ExpandedSCEVs is used to
503+
/// look up SCEV expansions for expressions needed during skeleton creation.
504+
virtual std::pair<BasicBlock *, Value *>
505+
createVectorizedLoopSkeleton(const SCEV2ValueTy &ExpandedSCEVs);
502506

503507
/// Fix the vectorized code, taking care of header phi's, live-outs, and more.
504508
void fixVectorizedLoop(VPTransformState &State, VPlan &Plan);
@@ -555,12 +559,13 @@ class InnerLoopVectorizer {
555559

556560
/// Create a new phi node for the induction variable \p OrigPhi to resume
557561
/// iteration count in the scalar epilogue, from where the vectorized loop
558-
/// left off. In cases where the loop skeleton is more complicated (eg.
559-
/// epilogue vectorization) and the resume values can come from an additional
560-
/// bypass block, the \p AdditionalBypass pair provides information about the
561-
/// bypass block and the end value on the edge from bypass to this loop.
562+
/// left off. \p Step is the SCEV-expanded induction step to use. In cases
563+
/// where the loop skeleton is more complicated (i.e., epilogue vectorization)
564+
/// and the resume values can come from an additional bypass block, the \p
565+
/// AdditionalBypass pair provides information about the bypass block and the
566+
/// end value on the edge from bypass to this loop.
562567
PHINode *createInductionResumeValue(
563-
PHINode *OrigPhi, const InductionDescriptor &ID,
568+
PHINode *OrigPhi, const InductionDescriptor &ID, Value *Step,
564569
ArrayRef<BasicBlock *> BypassBlocks,
565570
std::pair<BasicBlock *, Value *> AdditionalBypass = {nullptr, nullptr});
566571

@@ -646,6 +651,7 @@ class InnerLoopVectorizer {
646651
/// block, the \p AdditionalBypass pair provides information about the bypass
647652
/// block and the end value on the edge from bypass to this loop.
648653
void createInductionResumeValues(
654+
const SCEV2ValueTy &ExpandedSCEVs,
649655
std::pair<BasicBlock *, Value *> AdditionalBypass = {nullptr, nullptr});
650656

651657
/// Complete the loop skeleton by adding debug MDs, creating appropriate
@@ -835,15 +841,18 @@ class InnerLoopAndEpilogueVectorizer : public InnerLoopVectorizer {
835841

836842
// Override this function to handle the more complex control flow around the
837843
// three loops.
838-
std::pair<BasicBlock *, Value *> createVectorizedLoopSkeleton() final {
839-
return createEpilogueVectorizedLoopSkeleton();
844+
std::pair<BasicBlock *, Value *> createVectorizedLoopSkeleton(
845+
846+
const SCEV2ValueTy &ExpandedSCEVs) final {
847+
848+
return createEpilogueVectorizedLoopSkeleton(ExpandedSCEVs);
840849
}
841850

842851
/// The interface for creating a vectorized skeleton using one of two
843852
/// different strategies, each corresponding to one execution of the vplan
844853
/// as described above.
845854
virtual std::pair<BasicBlock *, Value *>
846-
createEpilogueVectorizedLoopSkeleton() = 0;
855+
createEpilogueVectorizedLoopSkeleton(const SCEV2ValueTy &ExpandedSCEVs) = 0;
847856

848857
/// Holds and updates state information required to vectorize the main loop
849858
/// and its epilogue in two separate passes. This setup helps us avoid
@@ -871,7 +880,8 @@ class EpilogueVectorizerMainLoop : public InnerLoopAndEpilogueVectorizer {
871880
EPI, LVL, CM, BFI, PSI, Check) {}
872881
/// Implements the interface for creating a vectorized skeleton using the
873882
/// *main loop* strategy (ie the first pass of vplan execution).
874-
std::pair<BasicBlock *, Value *> createEpilogueVectorizedLoopSkeleton() final;
883+
std::pair<BasicBlock *, Value *>
884+
createEpilogueVectorizedLoopSkeleton(const SCEV2ValueTy &ExpandedSCEVs) final;
875885

876886
protected:
877887
/// Emits an iteration count bypass check once for the main loop (when \p
@@ -901,7 +911,8 @@ class EpilogueVectorizerEpilogueLoop : public InnerLoopAndEpilogueVectorizer {
901911
}
902912
/// Implements the interface for creating a vectorized skeleton using the
903913
/// *epilogue loop* strategy (ie the second pass of vplan execution).
904-
std::pair<BasicBlock *, Value *> createEpilogueVectorizedLoopSkeleton() final;
914+
std::pair<BasicBlock *, Value *>
915+
createEpilogueVectorizedLoopSkeleton(const SCEV2ValueTy &ExpandedSCEVs) final;
905916

906917
protected:
907918
/// Emits an iteration count bypass check after the main vector loop has
@@ -2424,21 +2435,6 @@ static void buildScalarSteps(Value *ScalarIV, Value *Step,
24242435
}
24252436
}
24262437

2427-
// Generate code for the induction step. Note that induction steps are
2428-
// required to be loop-invariant
2429-
static Value *CreateStepValue(const SCEV *Step, ScalarEvolution &SE,
2430-
Instruction *InsertBefore,
2431-
Loop *OrigLoop = nullptr) {
2432-
const DataLayout &DL = SE.getDataLayout();
2433-
assert((!OrigLoop || SE.isLoopInvariant(Step, OrigLoop)) &&
2434-
"Induction step should be loop invariant");
2435-
if (auto *E = dyn_cast<SCEVUnknown>(Step))
2436-
return E->getValue();
2437-
2438-
SCEVExpander Exp(SE, DL, "induction");
2439-
return Exp.expandCodeFor(Step, Step->getType(), InsertBefore);
2440-
}
2441-
24422438
/// Compute the transformed value of Index at offset StartValue using step
24432439
/// StepValue.
24442440
/// For integer induction, returns StartValue + Index * StepValue.
@@ -3142,7 +3138,7 @@ void InnerLoopVectorizer::createVectorLoopSkeleton(StringRef Prefix) {
31423138
}
31433139

31443140
PHINode *InnerLoopVectorizer::createInductionResumeValue(
3145-
PHINode *OrigPhi, const InductionDescriptor &II,
3141+
PHINode *OrigPhi, const InductionDescriptor &II, Value *Step,
31463142
ArrayRef<BasicBlock *> BypassBlocks,
31473143
std::pair<BasicBlock *, Value *> AdditionalBypass) {
31483144
Value *VectorTripCount = getOrCreateVectorTripCount(LoopVectorPreHeader);
@@ -3161,17 +3157,13 @@ PHINode *InnerLoopVectorizer::createInductionResumeValue(
31613157
if (II.getInductionBinOp() && isa<FPMathOperator>(II.getInductionBinOp()))
31623158
B.setFastMathFlags(II.getInductionBinOp()->getFastMathFlags());
31633159

3164-
Value *Step =
3165-
CreateStepValue(II.getStep(), *PSE.getSE(), &*B.GetInsertPoint());
31663160
EndValue =
31673161
emitTransformedIndex(B, VectorTripCount, II.getStartValue(), Step, II);
31683162
EndValue->setName("ind.end");
31693163

31703164
// Compute the end value for the additional bypass (if applicable).
31713165
if (AdditionalBypass.first) {
31723166
B.SetInsertPoint(&(*AdditionalBypass.first->getFirstInsertionPt()));
3173-
Value *Step =
3174-
CreateStepValue(II.getStep(), *PSE.getSE(), &*B.GetInsertPoint());
31753167
EndValueFromAdditionalBypass = emitTransformedIndex(
31763168
B, AdditionalBypass.second, II.getStartValue(), Step, II);
31773169
EndValueFromAdditionalBypass->setName("ind.end");
@@ -3200,7 +3192,22 @@ PHINode *InnerLoopVectorizer::createInductionResumeValue(
32003192
return BCResumeVal;
32013193
}
32023194

3195+
/// Return the expanded step for \p ID using \p ExpandedSCEVs to look up SCEV
3196+
/// expansion results.
3197+
static Value *getExpandedStep(const InductionDescriptor &ID,
3198+
const SCEV2ValueTy &ExpandedSCEVs) {
3199+
const SCEV *Step = ID.getStep();
3200+
if (auto *C = dyn_cast<SCEVConstant>(Step))
3201+
return C->getValue();
3202+
if (auto *U = dyn_cast<SCEVUnknown>(Step))
3203+
return U->getValue();
3204+
auto I = ExpandedSCEVs.find(Step);
3205+
assert(I != ExpandedSCEVs.end() && "SCEV must be expanded at this point");
3206+
return I->second;
3207+
}
3208+
32033209
void InnerLoopVectorizer::createInductionResumeValues(
3210+
const SCEV2ValueTy &ExpandedSCEVs,
32043211
std::pair<BasicBlock *, Value *> AdditionalBypass) {
32053212
assert(((AdditionalBypass.first && AdditionalBypass.second) ||
32063213
(!AdditionalBypass.first && !AdditionalBypass.second)) &&
@@ -3216,7 +3223,8 @@ void InnerLoopVectorizer::createInductionResumeValues(
32163223
PHINode *OrigPhi = InductionEntry.first;
32173224
const InductionDescriptor &II = InductionEntry.second;
32183225
PHINode *BCResumeVal = createInductionResumeValue(
3219-
OrigPhi, II, LoopBypassBlocks, AdditionalBypass);
3226+
OrigPhi, II, getExpandedStep(II, ExpandedSCEVs), LoopBypassBlocks,
3227+
AdditionalBypass);
32203228
OrigPhi->setIncomingValueForBlock(LoopScalarPreHeader, BCResumeVal);
32213229
}
32223230
}
@@ -3257,7 +3265,8 @@ BasicBlock *InnerLoopVectorizer::completeLoopSkeleton() {
32573265
}
32583266

32593267
std::pair<BasicBlock *, Value *>
3260-
InnerLoopVectorizer::createVectorizedLoopSkeleton() {
3268+
InnerLoopVectorizer::createVectorizedLoopSkeleton(
3269+
const SCEV2ValueTy &ExpandedSCEVs) {
32613270
/*
32623271
In this function we generate a new loop. The new loop will contain
32633272
the vectorized instructions while the old loop will continue to run the
@@ -3312,7 +3321,7 @@ InnerLoopVectorizer::createVectorizedLoopSkeleton() {
33123321
emitMemRuntimeChecks(LoopScalarPreHeader);
33133322

33143323
// Emit phis for the new starting index of the scalar loop.
3315-
createInductionResumeValues();
3324+
createInductionResumeValues(ExpandedSCEVs);
33163325

33173326
return {completeLoopSkeleton(), nullptr};
33183327
}
@@ -7674,11 +7683,9 @@ static void AddRuntimeUnrollDisableMetaData(Loop *L) {
76747683
}
76757684
}
76767685

7677-
void LoopVectorizationPlanner::executePlan(ElementCount BestVF, unsigned BestUF,
7678-
VPlan &BestVPlan,
7679-
InnerLoopVectorizer &ILV,
7680-
DominatorTree *DT,
7681-
bool IsEpilogueVectorization) {
7686+
SCEV2ValueTy LoopVectorizationPlanner::executePlan(
7687+
ElementCount BestVF, unsigned BestUF, VPlan &BestVPlan,
7688+
InnerLoopVectorizer &ILV, DominatorTree *DT, bool IsEpilogueVectorization) {
76827689
assert(BestVPlan.hasVF(BestVF) &&
76837690
"Trying to execute plan with unsupported VF");
76847691
assert(BestVPlan.hasUF(BestUF) &&
@@ -7710,7 +7717,7 @@ void LoopVectorizationPlanner::executePlan(ElementCount BestVF, unsigned BestUF,
77107717
// middle block. The vector loop is created during VPlan execution.
77117718
Value *CanonicalIVStartValue;
77127719
std::tie(State.CFG.PrevBB, CanonicalIVStartValue) =
7713-
ILV.createVectorizedLoopSkeleton();
7720+
ILV.createVectorizedLoopSkeleton(State.ExpandedSCEVs);
77147721

77157722
// Only use noalias metadata when using memory checks guaranteeing no overlap
77167723
// across all iterations.
@@ -7778,6 +7785,8 @@ void LoopVectorizationPlanner::executePlan(ElementCount BestVF, unsigned BestUF,
77787785
ILV.fixVectorizedLoop(State, BestVPlan);
77797786

77807787
ILV.printDebugTracesAtEnd();
7788+
7789+
return State.ExpandedSCEVs;
77817790
}
77827791

77837792
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
@@ -7799,7 +7808,8 @@ Value *InnerLoopUnroller::getBroadcastInstrs(Value *V) { return V; }
77997808
/// This function is partially responsible for generating the control flow
78007809
/// depicted in https://llvm.org/docs/Vectorizers.html#epilogue-vectorization.
78017810
std::pair<BasicBlock *, Value *>
7802-
EpilogueVectorizerMainLoop::createEpilogueVectorizedLoopSkeleton() {
7811+
EpilogueVectorizerMainLoop::createEpilogueVectorizedLoopSkeleton(
7812+
const SCEV2ValueTy &ExpandedSCEVs) {
78037813
createVectorLoopSkeleton("");
78047814

78057815
// Generate the code to check the minimum iteration count of the vector
@@ -7917,7 +7927,8 @@ EpilogueVectorizerMainLoop::emitIterationCountCheck(BasicBlock *Bypass,
79177927
/// This function is partially responsible for generating the control flow
79187928
/// depicted in https://llvm.org/docs/Vectorizers.html#epilogue-vectorization.
79197929
std::pair<BasicBlock *, Value *>
7920-
EpilogueVectorizerEpilogueLoop::createEpilogueVectorizedLoopSkeleton() {
7930+
EpilogueVectorizerEpilogueLoop::createEpilogueVectorizedLoopSkeleton(
7931+
const SCEV2ValueTy &ExpandedSCEVs) {
79217932
createVectorLoopSkeleton("vec.epilog.");
79227933

79237934
// Now, compare the remaining count and if there aren't enough iterations to
@@ -8015,7 +8026,8 @@ EpilogueVectorizerEpilogueLoop::createEpilogueVectorizedLoopSkeleton() {
80158026
// check, then the resume value for the induction variable comes from
80168027
// the trip count of the main vector loop, hence passing the AdditionalBypass
80178028
// argument.
8018-
createInductionResumeValues({VecEpilogueIterationCountCheck,
8029+
createInductionResumeValues(ExpandedSCEVs,
8030+
{VecEpilogueIterationCountCheck,
80198031
EPI.VectorTripCount} /* AdditionalBypass */);
80208032

80218033
return {completeLoopSkeleton(), EPResumeVal};
@@ -10387,8 +10399,8 @@ bool LoopVectorizePass::processLoop(Loop *L) {
1038710399
EPI, &LVL, &CM, BFI, PSI, Checks);
1038810400

1038910401
VPlan &BestMainPlan = LVP.getBestPlanFor(EPI.MainLoopVF);
10390-
LVP.executePlan(EPI.MainLoopVF, EPI.MainLoopUF, BestMainPlan, MainILV,
10391-
DT, true);
10402+
auto ExpandedSCEVs = LVP.executePlan(EPI.MainLoopVF, EPI.MainLoopUF,
10403+
BestMainPlan, MainILV, DT, true);
1039210404
++LoopsVectorized;
1039310405

1039410406
// Second pass vectorizes the epilogue and adjusts the control flow
@@ -10442,7 +10454,8 @@ bool LoopVectorizePass::processLoop(Loop *L) {
1044210454
}
1044310455

1044410456
ResumeV = MainILV.createInductionResumeValue(
10445-
IndPhi, *ID, {EPI.MainLoopIterationCountCheck});
10457+
IndPhi, *ID, getExpandedStep(*ID, ExpandedSCEVs),
10458+
{EPI.MainLoopIterationCountCheck});
1044610459
}
1044710460
assert(ResumeV && "Must have a resume value");
1044810461
VPValue *StartVal = BestEpiPlan.getVPValueOrAddLiveIn(ResumeV);

llvm/lib/Transforms/Vectorize/VPlan.h

+4
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,10 @@ struct VPTransformState {
411411
/// This is currently only used to add no-alias metadata based on the
412412
/// memchecks. The actually versioning is performed manually.
413413
LoopVersioning *LVer = nullptr;
414+
415+
/// Map SCEVs to their expanded values. Populated when executing
416+
/// VPExpandSCEVRecipes.
417+
DenseMap<const SCEV *, Value *> ExpandedSCEVs;
414418
};
415419

416420
/// VPBlockBase is the building block of the Hierarchical Control-Flow Graph.

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -1136,7 +1136,9 @@ void VPExpandSCEVRecipe::execute(VPTransformState &State) {
11361136

11371137
Value *Res = Exp.expandCodeFor(Expr, Expr->getType(),
11381138
&*State.Builder.GetInsertPoint());
1139-
1139+
assert(!State.ExpandedSCEVs.contains(Expr) &&
1140+
"Same SCEV expanded multiple times");
1141+
State.ExpandedSCEVs[Expr] = Res;
11401142
for (unsigned Part = 0, UF = State.UF; Part < UF; ++Part)
11411143
State.set(this, Res, {Part, 0});
11421144
}

llvm/test/Transforms/LoopVectorize/create-induction-resume.ll

+3-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ define void @test(i32 %arg, i32 %L1.limit, i32 %L2.switch, i1 %c) {
2929
; CHECK: L1.early.exit:
3030
; CHECK-NEXT: ret void
3131
; CHECK: L1.exit:
32-
; CHECK-NEXT: [[INDUCTION_IV_LCSSA2:%.*]] = phi i32 [ [[INDUCTION_IV]], [[L1_BACKEDGE]] ]
3332
; CHECK-NEXT: [[INDUCTION_IV_LCSSA1:%.*]] = phi i32 [ [[INDUCTION_IV]], [[L1_BACKEDGE]] ]
3433
; CHECK-NEXT: [[L1_EXIT_VAL:%.*]] = phi i32 [ [[L1_SUM_NEXT]], [[L1_BACKEDGE]] ]
3534
; CHECK-NEXT: br label [[L2_HEADER:%.*]]
@@ -45,7 +44,7 @@ define void @test(i32 %arg, i32 %L1.limit, i32 %L2.switch, i1 %c) {
4544
; CHECK: L2.Inner.header.preheader:
4645
; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
4746
; CHECK: vector.ph:
48-
; CHECK-NEXT: [[TMP3:%.*]] = mul i32 12, [[INDUCTION_IV_LCSSA2]]
47+
; CHECK-NEXT: [[TMP3:%.*]] = mul i32 12, [[INDUCTION_IV_LCSSA1]]
4948
; CHECK-NEXT: [[IND_END:%.*]] = add i32 1, [[TMP3]]
5049
; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
5150
; CHECK: vector.body:
@@ -58,11 +57,11 @@ define void @test(i32 %arg, i32 %L1.limit, i32 %L2.switch, i1 %c) {
5857
; CHECK-NEXT: br i1 [[CMP_N]], label [[L2_HEADER_LOOPEXIT:%.*]], label [[SCALAR_PH]]
5958
; CHECK: scalar.ph:
6059
; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ [[IND_END]], [[MIDDLE_BLOCK]] ], [ 1, [[L2_INNER_HEADER_PREHEADER]] ]
61-
; CHECK-NEXT: [[BC_RESUME_VAL3:%.*]] = phi i64 [ 13, [[MIDDLE_BLOCK]] ], [ 1, [[L2_INNER_HEADER_PREHEADER]] ]
60+
; CHECK-NEXT: [[BC_RESUME_VAL2:%.*]] = phi i64 [ 13, [[MIDDLE_BLOCK]] ], [ 1, [[L2_INNER_HEADER_PREHEADER]] ]
6261
; CHECK-NEXT: br label [[L2_INNER_HEADER:%.*]]
6362
; CHECK: L2.Inner.header:
6463
; CHECK-NEXT: [[L2_ACCUM:%.*]] = phi i32 [ [[L2_ACCUM_NEXT:%.*]], [[L2_INNER_HEADER]] ], [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ]
65-
; CHECK-NEXT: [[L2_IV:%.*]] = phi i64 [ [[L2_IV_NEXT:%.*]], [[L2_INNER_HEADER]] ], [ [[BC_RESUME_VAL3]], [[SCALAR_PH]] ]
64+
; CHECK-NEXT: [[L2_IV:%.*]] = phi i64 [ [[L2_IV_NEXT:%.*]], [[L2_INNER_HEADER]] ], [ [[BC_RESUME_VAL2]], [[SCALAR_PH]] ]
6665
; CHECK-NEXT: [[L2_ACCUM_NEXT]] = sub i32 [[L2_ACCUM]], [[L1_EXIT_VAL]]
6766
; CHECK-NEXT: [[L2_DUMMY_BUT_NEED_IT:%.*]] = sext i32 [[L2_ACCUM_NEXT]] to i64
6867
; CHECK-NEXT: [[L2_IV_NEXT]] = add nuw nsw i64 [[L2_IV]], 1

llvm/test/Transforms/LoopVectorize/pointer-induction-unroll.ll

+2-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@ define void @non_constant_scalar_expansion(i32 %0, ptr %call) {
2727
; STRIDED-NEXT: [[TMP1:%.*]] = sext i32 [[MUL]] to i64
2828
; STRIDED-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
2929
; STRIDED: vector.ph:
30-
; STRIDED-NEXT: [[TMP2:%.*]] = sext i32 [[MUL]] to i64
31-
; STRIDED-NEXT: [[TMP3:%.*]] = mul i64 4294967264, [[TMP2]]
32-
; STRIDED-NEXT: [[IND_END:%.*]] = getelementptr i8, ptr null, i64 [[TMP3]]
30+
; STRIDED-NEXT: [[TMP2:%.*]] = mul i64 4294967264, [[TMP1]]
31+
; STRIDED-NEXT: [[IND_END:%.*]] = getelementptr i8, ptr null, i64 [[TMP2]]
3332
; STRIDED-NEXT: br label [[VECTOR_BODY:%.*]]
3433
; STRIDED: vector.body:
3534
; STRIDED-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]

llvm/test/Transforms/LoopVectorize/pointer-induction.ll

+2-3
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,8 @@ define void @non_constant_vector_expansion(i32 %0, ptr %call) {
233233
; STRIDED: vector.scevcheck:
234234
; STRIDED-NEXT: br i1 true, label [[SCALAR_PH]], label [[VECTOR_PH:%.*]]
235235
; STRIDED: vector.ph:
236-
; STRIDED-NEXT: [[TMP2:%.*]] = sext i32 [[MUL]] to i64
237-
; STRIDED-NEXT: [[TMP3:%.*]] = mul i64 4294967264, [[TMP2]]
238-
; STRIDED-NEXT: [[IND_END:%.*]] = getelementptr i8, ptr null, i64 [[TMP3]]
236+
; STRIDED-NEXT: [[TMP2:%.*]] = mul i64 4294967264, [[TMP1]]
237+
; STRIDED-NEXT: [[IND_END:%.*]] = getelementptr i8, ptr null, i64 [[TMP2]]
239238
; STRIDED-NEXT: br label [[VECTOR_BODY:%.*]]
240239
; STRIDED: vector.body:
241240
; STRIDED-NEXT: [[POINTER_PHI:%.*]] = phi ptr [ null, [[VECTOR_PH]] ], [ [[PTR_IND:%.*]], [[VECTOR_BODY]] ]

0 commit comments

Comments
 (0)