diff --git a/llvm/include/llvm/Analysis/CGSCCPassManager.h b/llvm/include/llvm/Analysis/CGSCCPassManager.h --- a/llvm/include/llvm/Analysis/CGSCCPassManager.h +++ b/llvm/include/llvm/Analysis/CGSCCPassManager.h @@ -390,8 +390,11 @@ using PassModelT = detail::PassModel; + // Do not use make_unique, it causes too many template instantiations, + // causing terrible compile times. return ModuleToPostOrderCGSCCPassAdaptor( - std::make_unique(std::forward(Pass))); + std::unique_ptr( + new PassModelT(std::forward(Pass)))); } /// A proxy from a \c FunctionAnalysisManager to an \c SCC. @@ -515,8 +518,11 @@ using PassModelT = detail::PassModel; + // Do not use make_unique, it causes too many template instantiations, + // causing terrible compile times. return CGSCCToFunctionPassAdaptor( - std::make_unique(std::forward(Pass))); + std::unique_ptr( + new PassModelT(std::forward(Pass)))); } /// A helper that repeats an SCC pass each time an indirect call is refined to @@ -568,8 +574,11 @@ using PassModelT = detail::PassModel; + // Do not use make_unique, it causes too many template instantiations, + // causing terrible compile times. return DevirtSCCRepeatedPass( - std::make_unique(std::forward(Pass)), + std::unique_ptr( + new PassModelT(std::forward(Pass))), MaxIterations); } diff --git a/llvm/include/llvm/IR/PassManager.h b/llvm/include/llvm/IR/PassManager.h --- a/llvm/include/llvm/IR/PassManager.h +++ b/llvm/include/llvm/IR/PassManager.h @@ -1226,8 +1226,11 @@ detail::PassModel; + // Do not use make_unique, it causes too many template instantiations, + // causing terrible compile times. return ModuleToFunctionPassAdaptor( - std::make_unique(std::forward(Pass))); + std::unique_ptr( + new PassModelT(std::forward(Pass)))); } /// A utility pass template to force an analysis result to be available. diff --git a/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h b/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h --- a/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h +++ b/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h @@ -469,9 +469,13 @@ using PassModelT = detail::PassModel; + // Do not use make_unique, it causes too many template instantiations, + // causing terrible compile times. + return FunctionToLoopPassAdaptor( - std::make_unique(std::forward(Pass)), UseMemorySSA, - UseBlockFrequencyInfo, UseBranchProbabilityInfo, false); + std::unique_ptr( + new PassModelT(std::forward(Pass))), + UseMemorySSA, UseBlockFrequencyInfo, UseBranchProbabilityInfo, false); } /// If \p Pass is a loop-nest pass, \p Pass will first be wrapped into a @@ -488,9 +492,10 @@ detail::PassModel; - return FunctionToLoopPassAdaptor(std::make_unique(std::move(LPM)), - UseMemorySSA, UseBlockFrequencyInfo, - UseBranchProbabilityInfo, true); + return FunctionToLoopPassAdaptor( + std::unique_ptr( + new PassModelT(std::move(LPM))), + UseMemorySSA, UseBlockFrequencyInfo, UseBranchProbabilityInfo, true); } /// If \p Pass is an instance of \c LoopPassManager, the returned adaptor will @@ -507,9 +512,11 @@ LoopAnalysisManager, LoopStandardAnalysisResults &, LPMUpdater &>; bool LoopNestMode = (LPM.getNumLoopPasses() == 0); - return FunctionToLoopPassAdaptor(std::make_unique(std::move(LPM)), - UseMemorySSA, UseBlockFrequencyInfo, - UseBranchProbabilityInfo, LoopNestMode); + return FunctionToLoopPassAdaptor( + std::unique_ptr( + new PassModelT(std::move(LPM))), + UseMemorySSA, UseBlockFrequencyInfo, UseBranchProbabilityInfo, + LoopNestMode); } /// Pass for printing a loop's contents as textual IR.