@@ -327,61 +327,6 @@ void PassManagerBuilder::populateFunctionPassManager(
327
327
FPM.add (createEarlyCSEPass ());
328
328
}
329
329
330
- // Do PGO instrumentation generation or use pass as the option specified.
331
- void PassManagerBuilder::addPGOInstrPasses (legacy::PassManagerBase &MPM,
332
- bool IsCS = false ) {
333
- if (IsCS) {
334
- if (!EnablePGOCSInstrGen && !EnablePGOCSInstrUse)
335
- return ;
336
- } else if (!EnablePGOInstrGen && PGOInstrUse.empty () && PGOSampleUse.empty ())
337
- return ;
338
-
339
- // Perform the preinline and cleanup passes for O1 and above.
340
- // We will not do this inline for context sensitive PGO (when IsCS is true).
341
- if (OptLevel > 0 && !DisablePreInliner && PGOSampleUse.empty () && !IsCS) {
342
- // Create preinline pass. We construct an InlineParams object and specify
343
- // the threshold here to avoid the command line options of the regular
344
- // inliner to influence pre-inlining. The only fields of InlineParams we
345
- // care about are DefaultThreshold and HintThreshold.
346
- InlineParams IP;
347
- IP.DefaultThreshold = PreInlineThreshold;
348
- // FIXME: The hint threshold has the same value used by the regular inliner
349
- // when not optimzing for size. This should probably be lowered after
350
- // performance testing.
351
- // Use PreInlineThreshold for both -Os and -Oz. Not running preinliner makes
352
- // the instrumented binary unusably large. Even if PreInlineThreshold is not
353
- // correct thresold for -Oz, it is better than not running preinliner.
354
- IP.HintThreshold = SizeLevel > 0 ? PreInlineThreshold : 325 ;
355
-
356
- MPM.add (createFunctionInliningPass (IP));
357
- MPM.add (createSROAPass ());
358
- MPM.add (createEarlyCSEPass ()); // Catch trivial redundancies
359
- MPM.add (createCFGSimplificationPass (
360
- SimplifyCFGOptions ().convertSwitchRangeToICmp (
361
- true ))); // Merge & remove BBs
362
- MPM.add (createInstructionCombiningPass ()); // Combine silly seq's
363
- addExtensionsToPM (EP_Peephole, MPM);
364
- }
365
- if ((EnablePGOInstrGen && !IsCS) || (EnablePGOCSInstrGen && IsCS)) {
366
- MPM.add (createPGOInstrumentationGenLegacyPass (IsCS));
367
- // Add the profile lowering pass.
368
- InstrProfOptions Options;
369
- if (!PGOInstrGen.empty ())
370
- Options.InstrProfileOutput = PGOInstrGen;
371
- Options.DoCounterPromotion = true ;
372
- Options.UseBFIInPromotion = IsCS;
373
- MPM.add (createLoopRotatePass ());
374
- MPM.add (createInstrProfilingLegacyPass (Options, IsCS));
375
- }
376
- if (!PGOInstrUse.empty ())
377
- MPM.add (createPGOInstrumentationUseLegacyPass (PGOInstrUse, IsCS));
378
- // Indirect call promotion that promotes intra-module targets only.
379
- // For ThinLTO this is done earlier due to interactions with globalopt
380
- // for imported functions. We don't run this at -O0.
381
- if (OptLevel > 0 && !IsCS)
382
- MPM.add (
383
- createPGOIndirectCallPromotionLegacyPass (false , !PGOSampleUse.empty ()));
384
- }
385
330
void PassManagerBuilder::addFunctionSimplificationPasses (
386
331
legacy::PassManagerBase &MPM) {
387
332
// Start of function pass.
@@ -423,10 +368,6 @@ void PassManagerBuilder::addFunctionSimplificationPasses(
423
368
MPM.add (createLibCallsShrinkWrapPass ());
424
369
addExtensionsToPM (EP_Peephole, MPM);
425
370
426
- // Optimize memory intrinsic calls based on the profiled size information.
427
- if (SizeLevel == 0 )
428
- MPM.add (createPGOMemOPSizeOptLegacyPass ());
429
-
430
371
// TODO: Investigate the cost/benefit of tail call elimination on debugging.
431
372
if (OptLevel > 1 )
432
373
MPM.add (createTailCallEliminationPass ()); // Eliminate tail calls
@@ -666,10 +607,6 @@ void PassManagerBuilder::addVectorPasses(legacy::PassManagerBase &PM,
666
607
667
608
void PassManagerBuilder::populateModulePassManager (
668
609
legacy::PassManagerBase &MPM) {
669
- // Whether this is a default or *LTO pre-link pipeline. The FullLTO post-link
670
- // is handled separately, so just check this is not the ThinLTO post-link.
671
- bool DefaultOrPreLinkPipeline = !PerformThinLTO;
672
-
673
610
MPM.add (createAnnotation2MetadataLegacyPass ());
674
611
675
612
if (!PGOSampleUse.empty ()) {
@@ -687,7 +624,6 @@ void PassManagerBuilder::populateModulePassManager(
687
624
// If all optimizations are disabled, just run the always-inline pass and,
688
625
// if enabled, the function merging pass.
689
626
if (OptLevel == 0 ) {
690
- addPGOInstrPasses (MPM);
691
627
if (Inliner) {
692
628
MPM.add (Inliner);
693
629
Inliner = nullptr ;
@@ -741,8 +677,6 @@ void PassManagerBuilder::populateModulePassManager(
741
677
// earlier in the pass pipeline, here before globalopt. Otherwise imported
742
678
// available_externally functions look unreferenced and are removed.
743
679
if (PerformThinLTO) {
744
- MPM.add (createPGOIndirectCallPromotionLegacyPass (/* InLTO = */ true ,
745
- !PGOSampleUse.empty ()));
746
680
MPM.add (createLowerTypeTestsPass (nullptr , nullptr , true ));
747
681
}
748
682
@@ -785,19 +719,6 @@ void PassManagerBuilder::populateModulePassManager(
785
719
createCFGSimplificationPass (SimplifyCFGOptions ().convertSwitchRangeToICmp (
786
720
true ))); // Clean up after IPCP & DAE
787
721
788
- // For SamplePGO in ThinLTO compile phase, we do not want to do indirect
789
- // call promotion as it will change the CFG too much to make the 2nd
790
- // profile annotation in backend more difficult.
791
- // PGO instrumentation is added during the compile phase for ThinLTO, do
792
- // not run it a second time
793
- if (DefaultOrPreLinkPipeline && !PrepareForThinLTOUsingPGOSampleProfile)
794
- addPGOInstrPasses (MPM);
795
-
796
- // Create profile COMDAT variables. Lld linker wants to see all variables
797
- // before the LTO/ThinLTO link since it needs to resolve symbols/comdats.
798
- if (!PerformThinLTO && EnablePGOCSInstrGen)
799
- MPM.add (createPGOInstrumentationGenCreateVarLegacyPass (PGOInstrGen));
800
-
801
722
// We add a module alias analysis pass here. In part due to bugs in the
802
723
// analysis infrastructure this "works" in that the analysis stays alive
803
724
// for the entire SCC pass run below.
@@ -848,14 +769,6 @@ void PassManagerBuilder::populateModulePassManager(
848
769
// and saves running remaining passes on the eliminated functions.
849
770
MPM.add (createEliminateAvailableExternallyPass ());
850
771
851
- // CSFDO instrumentation and use pass. Don't invoke this for Prepare pass
852
- // for LTO and ThinLTO -- The actual pass will be called after all inlines
853
- // are performed.
854
- // Need to do this after COMDAT variables have been eliminated,
855
- // (i.e. after EliminateAvailableExternallyPass).
856
- if (!(PrepareForLTO || PrepareForThinLTO))
857
- addPGOInstrPasses (MPM, /* IsCS */ true );
858
-
859
772
if (EnableOrderFileInstrumentation)
860
773
MPM.add (createInstrOrderFilePass ());
861
774
@@ -1022,13 +935,6 @@ void PassManagerBuilder::addLTOOptimizationPasses(legacy::PassManagerBase &PM) {
1022
935
// Split call-site with more constrained arguments.
1023
936
PM.add (createCallSiteSplittingPass ());
1024
937
1025
- // Indirect call promotion. This should promote all the targets that are
1026
- // left by the earlier promotion pass that promotes intra-module targets.
1027
- // This two-step promotion is to save the compile time. For LTO, it should
1028
- // produce the same result as if we only do promotion here.
1029
- PM.add (
1030
- createPGOIndirectCallPromotionLegacyPass (true , !PGOSampleUse.empty ()));
1031
-
1032
938
// Propage constant function arguments by specializing the functions.
1033
939
if (EnableFunctionSpecialization && OptLevel > 2 )
1034
940
PM.add (createFunctionSpecializationPass ());
@@ -1094,9 +1000,6 @@ void PassManagerBuilder::addLTOOptimizationPasses(legacy::PassManagerBase &PM) {
1094
1000
1095
1001
PM.add (createPruneEHPass ()); // Remove dead EH info.
1096
1002
1097
- // CSFDO instrumentation and use pass.
1098
- addPGOInstrPasses (PM, /* IsCS */ true );
1099
-
1100
1003
// Infer attributes on declarations, call sites, arguments, etc. for an SCC.
1101
1004
if (AttributorRun & AttributorRunOption::CGSCC)
1102
1005
PM.add (createAttributorCGSCCLegacyPass ());
0 commit comments