[llvm-branch-commits] [llvm-profgen] Support [buildid:]0xaddr format in perfscript input (PR #190863)
Amir Ayupov via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Apr 7 17:20:08 PDT 2026
================
@@ -654,6 +661,43 @@ void HybridPerfReader::unwindSamples() {
"frame to match.");
}
+/// Parse an address that may optionally have a build ID prefix in
+/// [buildid:]addr format. Sets \p BuildID to the build ID prefix (empty if
+/// none) and \p Addr to the hex address. Returns true on success.
+/// Handles optional "0x" prefix on the address part.
+static bool parseAddressWithBuildID(StringRef Str, uint64_t &Addr,
+ StringRef &BuildID) {
+ BuildID = StringRef();
+ size_t ColonPos = Str.find(':');
+ if (ColonPos != StringRef::npos) {
+ BuildID = Str.substr(0, ColonPos);
+ Str = Str.substr(ColonPos + 1);
+ }
+ Str.consume_front("0x");
+ return !Str.getAsInteger(16, Addr);
+}
+
+/// Return the build ID to use for filtering perfscript addresses.
+/// If --filter-build-id is specified, use it as an override.
+/// Otherwise, use the auto-detected value from the binary.
+static StringRef getFilterBuildID(const ProfiledBinary *Binary) {
----------------
aaupov wrote:
This is mainly for testing, I'm OK with dropping this.
https://github.com/llvm/llvm-project/pull/190863
More information about the llvm-branch-commits
mailing list