[llvm] 7c03d5d - [VPlan] Use unique_ptr to clean up duplicated plan.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 27 12:52:09 PST 2024


Author: Florian Hahn
Date: 2024-01-27T20:51:55Z
New Revision: 7c03d5d41daad230406890499cf4fa14973ee5eb

URL: https://github.com/llvm/llvm-project/commit/7c03d5d41daad230406890499cf4fa14973ee5eb
DIFF: https://github.com/llvm/llvm-project/commit/7c03d5d41daad230406890499cf4fa14973ee5eb.diff

LOG: [VPlan] Use unique_ptr to clean up duplicated plan.

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 7721075c31353d0..fbc82fb9696e89e 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -10141,9 +10141,10 @@ bool LoopVectorizePass::processLoop(Loop *L) {
         EpilogueVectorizerMainLoop MainILV(L, PSE, LI, DT, TLI, TTI, AC, ORE,
                                            EPI, &LVL, &CM, BFI, PSI, Checks);
 
-        VPlan &BestMainPlan = *LVP.getBestPlanFor(EPI.MainLoopVF).duplicate();
+        std::unique_ptr<VPlan> BestMainPlan(
+            LVP.getBestPlanFor(EPI.MainLoopVF).duplicate());
         const auto &[ExpandedSCEVs, ReductionResumeValues] = LVP.executePlan(
-            EPI.MainLoopVF, EPI.MainLoopUF, BestMainPlan, MainILV, DT, true);
+            EPI.MainLoopVF, EPI.MainLoopUF, *BestMainPlan, MainILV, DT, true);
         ++LoopsVectorized;
 
         // Second pass vectorizes the epilogue and adjusts the control flow


        


More information about the llvm-commits mailing list