[llvm] [SampleFDO][NFC] Refactoring sample reader to support on-demand read profiles for given functions (PR #104654)

via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 17 07:39:45 PDT 2024


================
@@ -380,6 +380,22 @@ class SampleProfileReader {
     return sampleprof_error::success;
   }
 
+  /// Read sample profiles for the given functions. Currently it's only used for
+  /// extended binary format to load the profiles on-demand.
+  std::error_code read(const DenseSet<StringRef> &FuncsToUse) {
+    if (std::error_code EC = read(FuncsToUse, Profiles))
+      return EC;
+    return sampleprof_error::success;
+  };
+
+  /// Read sample profiles for the given functions and write them to the given
+  /// profile map. Currently it's only used for extended binary format to load
+  /// the profiles on-demand.
+  virtual std::error_code read(const DenseSet<StringRef> &FuncsToUse,
----------------
WenleiHe wrote:

As mentioned in the other PR, would be good to make API simpler -- always load into the same profile map owned by reader, without needing a profile map parameter. 

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


More information about the llvm-commits mailing list