Skip to content

Commit 2deb3a2

Browse files
committed
[LV] Fixup IV users only once during epilogue vectorization. (NFC)
Induction users only need to be updated when vectorizing the epilogue. Avoid running fixupIVUsers when vectorizing the main loop during epilogue vectorization.
1 parent cd938bf commit 2deb3a2

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,10 +539,10 @@ class InnerLoopVectorizer {
539539
friend class LoopVectorizationPlanner;
540540

541541
/// Set up the values of the IVs correctly when exiting the vector loop.
542-
void fixupIVUsers(PHINode *OrigPhi, const InductionDescriptor &II,
543-
Value *VectorTripCount, Value *EndValue,
544-
BasicBlock *MiddleBlock, VPlan &Plan,
545-
VPTransformState &State);
542+
virtual void fixupIVUsers(PHINode *OrigPhi, const InductionDescriptor &II,
543+
Value *VectorTripCount, Value *EndValue,
544+
BasicBlock *MiddleBlock, VPlan &Plan,
545+
VPTransformState &State);
546546

547547
/// Iteratively sink the scalarized operands of a predicated instruction into
548548
/// the block that was created for it.
@@ -770,6 +770,11 @@ class EpilogueVectorizerMainLoop : public InnerLoopAndEpilogueVectorizer {
770770
BasicBlock *emitIterationCountCheck(BasicBlock *Bypass, bool ForEpilogue);
771771
void printDebugTracesAtStart() override;
772772
void printDebugTracesAtEnd() override;
773+
774+
void fixupIVUsers(PHINode *OrigPhi, const InductionDescriptor &II,
775+
Value *VectorTripCount, Value *EndValue,
776+
BasicBlock *MiddleBlock, VPlan &Plan,
777+
VPTransformState &State) override {};
773778
};
774779

775780
// A specialized derived class of inner loop vectorizer that performs

0 commit comments

Comments
 (0)