[clang] [llvm] [compiler-rt] [clang-tools-extra] [Profile] Allow profile merging with multiple correlate files. (PR #75957)
Zequan Wu via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 20 12:36:29 PST 2023
================
@@ -118,18 +118,18 @@ cl::opt<std::string> ProfiledBinary(
"profiled-binary", cl::init(""),
cl::desc("Path to binary from which the profile was collected."),
cl::sub(ShowSubcommand), cl::sub(MergeSubcommand));
-cl::opt<std::string> DebugInfoFilename(
- "debug-info", cl::init(""),
+cl::list<std::string> DebugInfoFilenames(
+ "debug-info",
cl::desc(
"For show, read and extract profile metadata from debug info and show "
"the functions it found. For merge, use the provided debug info to "
"correlate the raw profile."),
cl::sub(ShowSubcommand), cl::sub(MergeSubcommand));
-cl::opt<std::string>
- BinaryFilename("binary-file", cl::init(""),
- cl::desc("For merge, use the provided unstripped bianry to "
- "correlate the raw profile."),
- cl::sub(MergeSubcommand));
+cl::list<std::string>
+ BinaryFilenames("binary-file",
+ cl::desc("For merge, use the provided unstripped bianry to "
+ "correlate the raw profile."),
+ cl::sub(MergeSubcommand));
----------------
ZequanWu wrote:
> It looks like we are switching from passing a single correlation file to a list of correlation files. Is that so that we can pass all raw profiles into a single llvm-profdata merge command?
Yes, that's the purpose.
> Presumably we should know which binaries produce which raw profiles.
This isn't always the case. When there are shared libraries producing raw profiles and `LLVM_PROFILE_FILE=default-%4m.profraw`, we will get bunch of `default-{hash}.profraw` produced by all shared libraries and main executable. There's no way to differentiate which raw profiles are generated by which binaries. @gulfemsavrun also has use case for this situation: https://discourse.llvm.org/t/rfc-add-binary-profile-correlation-to-not-load-profile-metadata-sections-into-memory-at-runtime/74565/8?u=zequanwu
https://github.com/llvm/llvm-project/pull/75957
More information about the cfe-commits
mailing list