[llvm] 2deb3a2 - [LV] Fixup IV users only once during epilogue vectorization. (NFC)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 19 18:11:19 PDT 2024


Author: Florian Hahn
Date: 2024-10-19T18:11:06-07:00
New Revision: 2deb3a26fa47a4640962489e5473726d7a8bf12b

URL: https://github.com/llvm/llvm-project/commit/2deb3a26fa47a4640962489e5473726d7a8bf12b
DIFF: https://github.com/llvm/llvm-project/commit/2deb3a26fa47a4640962489e5473726d7a8bf12b.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index ce0903b838aa8a..a95ac032b1ffbc 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -539,10 +539,10 @@ class InnerLoopVectorizer {
   friend class LoopVectorizationPlanner;
 
   /// Set up the values of the IVs correctly when exiting the vector loop.
-  void fixupIVUsers(PHINode *OrigPhi, const InductionDescriptor &II,
-                    Value *VectorTripCount, Value *EndValue,
-                    BasicBlock *MiddleBlock, VPlan &Plan,
-                    VPTransformState &State);
+  virtual void fixupIVUsers(PHINode *OrigPhi, const InductionDescriptor &II,
+                            Value *VectorTripCount, Value *EndValue,
+                            BasicBlock *MiddleBlock, VPlan &Plan,
+                            VPTransformState &State);
 
   /// Iteratively sink the scalarized operands of a predicated instruction into
   /// the block that was created for it.
@@ -770,6 +770,11 @@ class EpilogueVectorizerMainLoop : public InnerLoopAndEpilogueVectorizer {
   BasicBlock *emitIterationCountCheck(BasicBlock *Bypass, bool ForEpilogue);
   void printDebugTracesAtStart() override;
   void printDebugTracesAtEnd() override;
+
+  void fixupIVUsers(PHINode *OrigPhi, const InductionDescriptor &II,
+                    Value *VectorTripCount, Value *EndValue,
+                    BasicBlock *MiddleBlock, VPlan &Plan,
+                    VPTransformState &State) override {};
 };
 
 // A specialized derived class of inner loop vectorizer that performs


        


More information about the llvm-commits mailing list