[llvm] [SampleFDO] Support enabling sample loader pass in O0 mode (PR #113985)

via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 2 23:21:34 PDT 2024


================
@@ -1975,6 +1977,13 @@ bool SampleProfileLoader::doInitialization(Module &M,
 
   PSL = Reader->getProfileSymbolList();
 
+  if (DisableSampleLoaderInlining.getNumOccurrences())
+    DisableSampleProfileInlining = DisableSampleLoaderInlining;
+
+  // Use flattened profile if inlining is disabled.
+  if (DisableSampleProfileInlining && !Reader->profileIsCS())
+    ProfileConverter::flattenProfile(Reader->getProfiles());
----------------
WenleiHe wrote:

It makes sense to flatten profile if we are loading profile for O0. However, if we just disable sample loader inlining, but still runs O3/LTO, we may not want to flatten profile, because CGSCC inliner may have done some inlining, and we wanted to leverage context profile if possible? 

https://github.com/llvm/llvm-project/pull/113985


More information about the llvm-commits mailing list