@@ -195,8 +195,7 @@ static cl::opt<bool> ProfileSizeInline(
195195static cl::opt<bool > DisableSampleLoaderInlining (
196196 " disable-sample-loader-inlining" , cl::Hidden, cl::init(false ),
197197 cl::desc(" If true, artifically skip inline transformation in sample-loader "
198- " pass, and merge (or scale) profiles (as configured by "
199- " --sample-profile-merge-inlinee)." ));
198+ " pass, and use flattened profiles to emit annotation." ));
200199
201200namespace llvm {
202201cl::opt<bool >
@@ -1978,6 +1977,13 @@ bool SampleProfileLoader::doInitialization(Module &M,
19781977
19791978 PSL = Reader->getProfileSymbolList ();
19801979
1980+ if (DisableSampleLoaderInlining.getNumOccurrences ())
1981+ DisableSampleProfileInlining = DisableSampleLoaderInlining;
1982+
1983+ // Use flattened profile if inlining is disabled.
1984+ if (DisableSampleProfileInlining && !Reader->profileIsCS ())
1985+ ProfileConverter::flattenProfile (Reader->getProfiles ());
1986+
19811987 // While profile-sample-accurate is on, ignore symbol list.
19821988 ProfAccForSymsInList =
19831989 ProfileAccurateForSymsInList && PSL && !ProfileSampleAccurate;
@@ -2006,9 +2012,6 @@ bool SampleProfileLoader::doInitialization(Module &M,
20062012 /* EmitRemarks=*/ false , InlineContext{LTOPhase, InlinePass::ReplaySampleProfileInliner});
20072013 }
20082014
2009- if (DisableSampleLoaderInlining.getNumOccurrences ())
2010- DisableSampleProfileInlining = DisableSampleLoaderInlining;
2011-
20122015 // Apply tweaks if context-sensitive or probe-based profile is available.
20132016 if (Reader->profileIsCS () || Reader->profileIsPreInlined () ||
20142017 Reader->profileIsProbeBased ()) {
0 commit comments