[llvm] 7a53dc8 - [NFC] Add more comments about not using make_unique to pass managers/adaptors

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 4 16:11:31 PDT 2021


Author: Arthur Eubanks
Date: 2021-10-04T16:10:37-07:00
New Revision: 7a53dc811497e5134a742556ef8e996df28a716a

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

LOG: [NFC] Add more comments about not using make_unique to pass managers/adaptors

These were missed in D110784.

Added: 
    

Modified: 
    llvm/include/llvm/IR/PassManager.h
    llvm/include/llvm/Transforms/Scalar/LoopPassManager.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/PassManager.h b/llvm/include/llvm/IR/PassManager.h
index a409402a459a..6d422d59235a 100644
--- a/llvm/include/llvm/IR/PassManager.h
+++ b/llvm/include/llvm/IR/PassManager.h
@@ -553,7 +553,6 @@ class PassManager : public PassInfoMixin<
     using PassModelT =
         detail::PassModel<IRUnitT, PassT, PreservedAnalyses, AnalysisManagerT,
                           ExtraArgTs...>;
-
     // Do not use make_unique or emplace_back, they cause too many template
     // instantiations, causing terrible compile times.
     Passes.push_back(std::unique_ptr<PassConceptT>(
@@ -1225,7 +1224,6 @@ createModuleToFunctionPassAdaptor(FunctionPassT &&Pass) {
   using PassModelT =
       detail::PassModel<Function, FunctionPassT, PreservedAnalyses,
                         FunctionAnalysisManager>;
-
   // Do not use make_unique, it causes too many template instantiations,
   // causing terrible compile times.
   return ModuleToFunctionPassAdaptor(

diff  --git a/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h b/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h
index b9703d7143e5..71af0dd4eab4 100644
--- a/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h
+++ b/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h
@@ -123,6 +123,8 @@ class PassManager<Loop, LoopAnalysisManager, LoopStandardAnalysisResults &,
                           LoopAnalysisManager, LoopStandardAnalysisResults &,
                           LPMUpdater &>;
     IsLoopNestPass.push_back(true);
+    // Do not use make_unique or emplace_back, they cause too many template
+    // instantiations, causing terrible compile times.
     LoopNestPasses.push_back(std::unique_ptr<LoopNestPassConceptT>(
         new LoopNestPassModelT(std::forward<PassT>(Pass))));
   }
@@ -138,6 +140,8 @@ class PassManager<Loop, LoopAnalysisManager, LoopStandardAnalysisResults &,
                           LoopAnalysisManager, LoopStandardAnalysisResults &,
                           LPMUpdater &>;
     IsLoopNestPass.push_back(false);
+    // Do not use make_unique or emplace_back, they cause too many template
+    // instantiations, causing terrible compile times.
     LoopPasses.push_back(std::unique_ptr<LoopPassConceptT>(
         new RepeatedLoopPassModelT(std::move(Pass))));
   }
@@ -150,6 +154,8 @@ class PassManager<Loop, LoopAnalysisManager, LoopStandardAnalysisResults &,
                           LoopAnalysisManager, LoopStandardAnalysisResults &,
                           LPMUpdater &>;
     IsLoopNestPass.push_back(true);
+    // Do not use make_unique or emplace_back, they cause too many template
+    // instantiations, causing terrible compile times.
     LoopNestPasses.push_back(std::unique_ptr<LoopNestPassConceptT>(
         new RepeatedLoopNestPassModelT(std::move(Pass))));
   }
@@ -471,7 +477,6 @@ createFunctionToLoopPassAdaptor(LoopPassT &&Pass, bool UseMemorySSA = false,
                         LoopStandardAnalysisResults &, LPMUpdater &>;
   // Do not use make_unique, it causes too many template instantiations,
   // causing terrible compile times.
-
   return FunctionToLoopPassAdaptor(
       std::unique_ptr<FunctionToLoopPassAdaptor::PassConceptT>(
           new PassModelT(std::forward<LoopPassT>(Pass))),
@@ -492,6 +497,8 @@ createFunctionToLoopPassAdaptor(LoopNestPassT &&Pass, bool UseMemorySSA = false,
       detail::PassModel<Loop, LoopPassManager, PreservedAnalyses,
                         LoopAnalysisManager, LoopStandardAnalysisResults &,
                         LPMUpdater &>;
+  // Do not use make_unique, it causes too many template instantiations,
+  // causing terrible compile times.
   return FunctionToLoopPassAdaptor(
       std::unique_ptr<FunctionToLoopPassAdaptor::PassConceptT>(
           new PassModelT(std::move(LPM))),
@@ -512,6 +519,8 @@ createFunctionToLoopPassAdaptor<LoopPassManager>(
                         LoopAnalysisManager, LoopStandardAnalysisResults &,
                         LPMUpdater &>;
   bool LoopNestMode = (LPM.getNumLoopPasses() == 0);
+  // Do not use make_unique, it causes too many template instantiations,
+  // causing terrible compile times.
   return FunctionToLoopPassAdaptor(
       std::unique_ptr<FunctionToLoopPassAdaptor::PassConceptT>(
           new PassModelT(std::move(LPM))),


        


More information about the llvm-commits mailing list