[llvm] 8d3ff24 - [LV] Sink collect* calls to LVP::plan() (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 30 03:42:01 PDT 2023


Author: Florian Hahn
Date: 2023-04-30T11:41:22+01:00
New Revision: 8d3ff24e1155e03d2df1d6a26b9ec1e886aa1e97

URL: https://github.com/llvm/llvm-project/commit/8d3ff24e1155e03d2df1d6a26b9ec1e886aa1e97
DIFF: https://github.com/llvm/llvm-project/commit/8d3ff24e1155e03d2df1d6a26b9ec1e886aa1e97.diff

LOG: [LV] Sink collect* calls to LVP::plan() (NFC).

Move calls of collect* helpers closer to where the cost-model is used.
Should help simplifying D142669 & D142670.

Differential Revision: https://reviews.llvm.org/D142674

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 01ae3f5abe5eb..54fee331ca39b 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -7556,6 +7556,9 @@ LoopVectorizationPlanner::planInVPlanNativePath(ElementCount UserVF) {
 std::optional<VectorizationFactor>
 LoopVectorizationPlanner::plan(ElementCount UserVF, unsigned UserIC) {
   assert(OrigLoop->isInnermost() && "Inner loop expected.");
+  CM.collectValuesToIgnore();
+  CM.collectElementTypesForWidening();
+
   FixedScalableVFPair MaxFactors = CM.computeMaxVF(UserVF, UserIC);
   if (!MaxFactors) // Cases that should not to be vectorized nor interleaved.
     return std::nullopt;
@@ -10234,9 +10237,6 @@ bool LoopVectorizePass::processLoop(Loop *L) {
   // Use the cost model.
   LoopVectorizationCostModel CM(SEL, L, PSE, LI, &LVL, *TTI, TLI, DB, AC, ORE,
                                 F, &Hints, IAI);
-  CM.collectValuesToIgnore();
-  CM.collectElementTypesForWidening();
-
   // Use the planner for vectorization.
   LoopVectorizationPlanner LVP(L, LI, TLI, TTI, &LVL, CM, IAI, PSE, Hints, ORE);
 


        


More information about the llvm-commits mailing list