@@ -64,6 +64,12 @@ static cl::opt<bool>
6464 " than threshold, it will be trimmed." ),
6565 cl::cat(ProfGenCategory));
6666
67+ static cl::opt<bool > MarkAllContextPreinlined (
68+ " mark-all-context-preinlined" ,
69+ cl::desc (" Mark all function samples as preinlined(set "
70+ " ContextShouldBeInlined attribute)." ),
71+ cl::init(false ));
72+
6773static cl::opt<bool > CSProfMergeColdContext (
6874 " csprof-merge-cold-context" , cl::init(true ),
6975 cl::desc(" If the total count of context profile is smaller than "
@@ -511,10 +517,19 @@ void ProfileGenerator::generateProfile() {
511517 postProcessProfiles ();
512518}
513519
520+ void ProfileGeneratorBase::markAllContextPreinlined (
521+ SampleProfileMap &ProfileMap) {
522+ for (auto &I : ProfileMap)
523+ I.second .setContextAttribute (ContextShouldBeInlined);
524+ FunctionSamples::ProfileIsPreInlined = true ;
525+ }
526+
514527void ProfileGenerator::postProcessProfiles () {
515528 computeSummaryAndThreshold (ProfileMap);
516529 trimColdProfiles (ProfileMap, ColdCountThreshold);
517530 filterAmbiguousProfile (ProfileMap);
531+ if (MarkAllContextPreinlined)
532+ markAllContextPreinlined (ProfileMap);
518533 calculateAndShowDensity (ProfileMap);
519534}
520535
@@ -1130,6 +1145,8 @@ void CSProfileGenerator::postProcessProfiles() {
11301145 FunctionSamples::ProfileIsCS = false ;
11311146 }
11321147 filterAmbiguousProfile (ProfileMap);
1148+ if (MarkAllContextPreinlined)
1149+ markAllContextPreinlined (ProfileMap);
11331150 ProfileGeneratorBase::calculateAndShowDensity (ProfileMap);
11341151}
11351152
0 commit comments