Skip to content

Commit 7a53dc8

Browse files
committed
[NFC] Add more comments about not using make_unique to pass managers/adaptors
These were missed in D110784.
1 parent d95cd81 commit 7a53dc8

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

llvm/include/llvm/IR/PassManager.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,6 @@ class PassManager : public PassInfoMixin<
553553
using PassModelT =
554554
detail::PassModel<IRUnitT, PassT, PreservedAnalyses, AnalysisManagerT,
555555
ExtraArgTs...>;
556-
557556
// Do not use make_unique or emplace_back, they cause too many template
558557
// instantiations, causing terrible compile times.
559558
Passes.push_back(std::unique_ptr<PassConceptT>(
@@ -1225,7 +1224,6 @@ createModuleToFunctionPassAdaptor(FunctionPassT &&Pass) {
12251224
using PassModelT =
12261225
detail::PassModel<Function, FunctionPassT, PreservedAnalyses,
12271226
FunctionAnalysisManager>;
1228-
12291227
// Do not use make_unique, it causes too many template instantiations,
12301228
// causing terrible compile times.
12311229
return ModuleToFunctionPassAdaptor(

llvm/include/llvm/Transforms/Scalar/LoopPassManager.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ class PassManager<Loop, LoopAnalysisManager, LoopStandardAnalysisResults &,
123123
LoopAnalysisManager, LoopStandardAnalysisResults &,
124124
LPMUpdater &>;
125125
IsLoopNestPass.push_back(true);
126+
// Do not use make_unique or emplace_back, they cause too many template
127+
// instantiations, causing terrible compile times.
126128
LoopNestPasses.push_back(std::unique_ptr<LoopNestPassConceptT>(
127129
new LoopNestPassModelT(std::forward<PassT>(Pass))));
128130
}
@@ -138,6 +140,8 @@ class PassManager<Loop, LoopAnalysisManager, LoopStandardAnalysisResults &,
138140
LoopAnalysisManager, LoopStandardAnalysisResults &,
139141
LPMUpdater &>;
140142
IsLoopNestPass.push_back(false);
143+
// Do not use make_unique or emplace_back, they cause too many template
144+
// instantiations, causing terrible compile times.
141145
LoopPasses.push_back(std::unique_ptr<LoopPassConceptT>(
142146
new RepeatedLoopPassModelT(std::move(Pass))));
143147
}
@@ -150,6 +154,8 @@ class PassManager<Loop, LoopAnalysisManager, LoopStandardAnalysisResults &,
150154
LoopAnalysisManager, LoopStandardAnalysisResults &,
151155
LPMUpdater &>;
152156
IsLoopNestPass.push_back(true);
157+
// Do not use make_unique or emplace_back, they cause too many template
158+
// instantiations, causing terrible compile times.
153159
LoopNestPasses.push_back(std::unique_ptr<LoopNestPassConceptT>(
154160
new RepeatedLoopNestPassModelT(std::move(Pass))));
155161
}
@@ -471,7 +477,6 @@ createFunctionToLoopPassAdaptor(LoopPassT &&Pass, bool UseMemorySSA = false,
471477
LoopStandardAnalysisResults &, LPMUpdater &>;
472478
// Do not use make_unique, it causes too many template instantiations,
473479
// causing terrible compile times.
474-
475480
return FunctionToLoopPassAdaptor(
476481
std::unique_ptr<FunctionToLoopPassAdaptor::PassConceptT>(
477482
new PassModelT(std::forward<LoopPassT>(Pass))),
@@ -492,6 +497,8 @@ createFunctionToLoopPassAdaptor(LoopNestPassT &&Pass, bool UseMemorySSA = false,
492497
detail::PassModel<Loop, LoopPassManager, PreservedAnalyses,
493498
LoopAnalysisManager, LoopStandardAnalysisResults &,
494499
LPMUpdater &>;
500+
// Do not use make_unique, it causes too many template instantiations,
501+
// causing terrible compile times.
495502
return FunctionToLoopPassAdaptor(
496503
std::unique_ptr<FunctionToLoopPassAdaptor::PassConceptT>(
497504
new PassModelT(std::move(LPM))),
@@ -512,6 +519,8 @@ createFunctionToLoopPassAdaptor<LoopPassManager>(
512519
LoopAnalysisManager, LoopStandardAnalysisResults &,
513520
LPMUpdater &>;
514521
bool LoopNestMode = (LPM.getNumLoopPasses() == 0);
522+
// Do not use make_unique, it causes too many template instantiations,
523+
// causing terrible compile times.
515524
return FunctionToLoopPassAdaptor(
516525
std::unique_ptr<FunctionToLoopPassAdaptor::PassConceptT>(
517526
new PassModelT(std::move(LPM))),

0 commit comments

Comments
 (0)