@@ -193,64 +193,6 @@ PassManagerBuilder::~PassManagerBuilder() {
193
193
delete Inliner;
194
194
}
195
195
196
- // / Set of global extensions, automatically added as part of the standard set.
197
- static ManagedStatic<
198
- SmallVector<std::tuple<PassManagerBuilder::ExtensionPointTy,
199
- PassManagerBuilder::ExtensionFn,
200
- PassManagerBuilder::GlobalExtensionID>,
201
- 8 >>
202
- GlobalExtensions;
203
- static PassManagerBuilder::GlobalExtensionID GlobalExtensionsCounter;
204
-
205
- // / Check if GlobalExtensions is constructed and not empty.
206
- // / Since GlobalExtensions is a managed static, calling 'empty()' will trigger
207
- // / the construction of the object.
208
- static bool GlobalExtensionsNotEmpty () {
209
- return GlobalExtensions.isConstructed () && !GlobalExtensions->empty ();
210
- }
211
-
212
- PassManagerBuilder::GlobalExtensionID
213
- PassManagerBuilder::addGlobalExtension (PassManagerBuilder::ExtensionPointTy Ty,
214
- PassManagerBuilder::ExtensionFn Fn) {
215
- auto ExtensionID = GlobalExtensionsCounter++;
216
- GlobalExtensions->push_back (std::make_tuple (Ty, std::move (Fn), ExtensionID));
217
- return ExtensionID;
218
- }
219
-
220
- void PassManagerBuilder::removeGlobalExtension (
221
- PassManagerBuilder::GlobalExtensionID ExtensionID) {
222
- // RegisterStandardPasses may try to call this function after GlobalExtensions
223
- // has already been destroyed; doing so should not generate an error.
224
- if (!GlobalExtensions.isConstructed ())
225
- return ;
226
-
227
- auto GlobalExtension =
228
- llvm::find_if (*GlobalExtensions, [ExtensionID](const auto &elem) {
229
- return std::get<2 >(elem) == ExtensionID;
230
- });
231
- assert (GlobalExtension != GlobalExtensions->end () &&
232
- " The extension ID to be removed should always be valid." );
233
-
234
- GlobalExtensions->erase (GlobalExtension);
235
- }
236
-
237
- void PassManagerBuilder::addExtension (ExtensionPointTy Ty, ExtensionFn Fn) {
238
- Extensions.push_back (std::make_pair (Ty, std::move (Fn)));
239
- }
240
-
241
- void PassManagerBuilder::addExtensionsToPM (ExtensionPointTy ETy,
242
- legacy::PassManagerBase &PM) const {
243
- if (GlobalExtensionsNotEmpty ()) {
244
- for (auto &Ext : *GlobalExtensions) {
245
- if (std::get<0 >(Ext) == ETy)
246
- std::get<1 >(Ext)(*this , PM);
247
- }
248
- }
249
- for (const auto &[PT, Fn] : Extensions)
250
- if (PT == ETy)
251
- Fn (*this , PM);
252
- }
253
-
254
196
void PassManagerBuilder::addInitialAliasAnalysisPasses (
255
197
legacy::PassManagerBase &PM) const {
256
198
switch (UseCFLAA) {
@@ -277,8 +219,6 @@ void PassManagerBuilder::addInitialAliasAnalysisPasses(
277
219
278
220
void PassManagerBuilder::populateFunctionPassManager (
279
221
legacy::FunctionPassManager &FPM) {
280
- addExtensionsToPM (EP_EarlyAsPossible, FPM);
281
-
282
222
// Add LibraryInfo if we have some.
283
223
if (LibraryInfo)
284
224
FPM.add (new TargetLibraryInfoWrapperPass (*LibraryInfo));
@@ -341,7 +281,6 @@ void PassManagerBuilder::addFunctionSimplificationPasses(
341
281
MPM.add (createInstructionCombiningPass ());
342
282
if (SizeLevel == 0 && !DisableLibCallsShrinkWrap)
343
283
MPM.add (createLibCallsShrinkWrapPass ());
344
- addExtensionsToPM (EP_Peephole, MPM);
345
284
346
285
// TODO: Investigate the cost/benefit of tail call elimination on debugging.
347
286
if (OptLevel > 1 )
@@ -391,7 +330,6 @@ void PassManagerBuilder::addFunctionSimplificationPasses(
391
330
}
392
331
MPM.add (createLoopIdiomPass ()); // Recognize idioms like memset.
393
332
MPM.add (createIndVarSimplifyPass ()); // Canonicalize indvars
394
- addExtensionsToPM (EP_LateLoopOptimizations, MPM);
395
333
MPM.add (createLoopDeletionPass ()); // Delete dead loops
396
334
397
335
if (EnableLoopInterchange)
@@ -400,7 +338,6 @@ void PassManagerBuilder::addFunctionSimplificationPasses(
400
338
// Unroll small loops and perform peeling.
401
339
MPM.add (createSimpleLoopUnrollPass (OptLevel, DisableUnrollLoops,
402
340
ForgetAllSCEVInLoopUnroll));
403
- addExtensionsToPM (EP_LoopOptimizerEnd, MPM);
404
341
// This ends the loop pass pipelines.
405
342
406
343
// Break up allocas that may now be splittable after loop unrolling.
@@ -424,7 +361,6 @@ void PassManagerBuilder::addFunctionSimplificationPasses(
424
361
// Run instcombine after redundancy elimination to exploit opportunities
425
362
// opened up by them.
426
363
MPM.add (createInstructionCombiningPass ());
427
- addExtensionsToPM (EP_Peephole, MPM);
428
364
if (OptLevel > 1 ) {
429
365
if (EnableDFAJumpThreading && SizeLevel == 0 )
430
366
MPM.add (createDFAJumpThreadingPass ());
@@ -442,8 +378,6 @@ void PassManagerBuilder::addFunctionSimplificationPasses(
442
378
/* AllowSpeculation=*/ true ));
443
379
}
444
380
445
- addExtensionsToPM (EP_ScalarOptimizerLate, MPM);
446
-
447
381
if (RerollLoops)
448
382
MPM.add (createLoopRerollPass ());
449
383
@@ -452,7 +386,6 @@ void PassManagerBuilder::addFunctionSimplificationPasses(
452
386
SimplifyCFGOptions ().hoistCommonInsts (true ).sinkCommonInsts (true )));
453
387
// Clean up after everything.
454
388
MPM.add (createInstructionCombiningPass ());
455
- addExtensionsToPM (EP_Peephole, MPM);
456
389
}
457
390
458
391
// / FIXME: Should LTO cause any differences to this set of passes?
@@ -536,7 +469,6 @@ void PassManagerBuilder::addVectorPasses(legacy::PassManagerBase &PM,
536
469
PM.add (createVectorCombinePass ());
537
470
538
471
if (!IsFullLTO) {
539
- addExtensionsToPM (EP_Peephole, PM);
540
472
PM.add (createInstructionCombiningPass ());
541
473
542
474
if (EnableUnrollAndJam && !DisableUnrollLoops) {
@@ -595,10 +527,6 @@ void PassManagerBuilder::populateModulePassManager(
595
527
// builds. The function merging pass is
596
528
if (MergeFunctions)
597
529
MPM.add (createMergeFunctionsPass ());
598
- else if (GlobalExtensionsNotEmpty () || !Extensions.empty ())
599
- MPM.add (createBarrierNoopPass ());
600
-
601
- addExtensionsToPM (EP_EnabledOnOptLevel0, MPM);
602
530
603
531
MPM.add (createAnnotationRemarksLegacyPass ());
604
532
return ;
@@ -617,8 +545,6 @@ void PassManagerBuilder::populateModulePassManager(
617
545
if (AttributorRun & AttributorRunOption::MODULE)
618
546
MPM.add (createAttributorLegacyPass ());
619
547
620
- addExtensionsToPM (EP_ModuleOptimizerEarly, MPM);
621
-
622
548
if (OptLevel > 2 )
623
549
MPM.add (createCallSiteSplittingPass ());
624
550
@@ -636,7 +562,6 @@ void PassManagerBuilder::populateModulePassManager(
636
562
MPM.add (createDeadArgEliminationPass ()); // Dead argument elimination
637
563
638
564
MPM.add (createInstructionCombiningPass ()); // Clean up after IPCP & DAE
639
- addExtensionsToPM (EP_Peephole, MPM);
640
565
MPM.add (
641
566
createCFGSimplificationPass (SimplifyCFGOptions ().convertSwitchRangeToICmp (
642
567
true ))); // Clean up after IPCP & DAE
@@ -665,7 +590,6 @@ void PassManagerBuilder::populateModulePassManager(
665
590
666
591
MPM.add (createPostOrderFunctionAttrsLegacyPass ());
667
592
668
- addExtensionsToPM (EP_CGSCCOptimizerLate, MPM);
669
593
addFunctionSimplificationPasses (MPM);
670
594
671
595
// FIXME: This is a HACK! The inliner pass above implicitly creates a CGSCC
@@ -740,8 +664,6 @@ void PassManagerBuilder::populateModulePassManager(
740
664
MPM.add (createEarlyCSEPass (false ));
741
665
}
742
666
743
- addExtensionsToPM (EP_VectorizerStart, MPM);
744
-
745
667
// Re-rotate loops in all our loop nests. These may have fallout out of
746
668
// rotated form due to GVN or other transformations, and the vectorizer relies
747
669
// on the rotated form. Disable header duplication at -Oz.
@@ -794,8 +716,6 @@ void PassManagerBuilder::populateModulePassManager(
794
716
MPM.add (createCFGSimplificationPass (
795
717
SimplifyCFGOptions ().convertSwitchRangeToICmp (true )));
796
718
797
- addExtensionsToPM (EP_OptimizerLast, MPM);
798
-
799
719
MPM.add (createAnnotationRemarksLegacyPass ());
800
720
}
801
721
0 commit comments