[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 19:51:17 PDT 2026


================
@@ -1197,8 +1262,15 @@ PerfContent PerfScriptReader::checkPerfScriptType(StringRef FileName) {
 
     // Detect sample with call stack
     int32_t Count = 0;
-    while (!TraceIt.isAtEoF() &&
-           !TraceIt.getCurrentLine().ltrim().getAsInteger(16, FrameAddr)) {
+    while (!TraceIt.isAtEoF()) {
+      StringRef FrameStr = TraceIt.getCurrentLine().ltrim();
+      // Strip optional buildid prefix for format detection.
+      size_t ColonPos = FrameStr.find(':');
+      if (ColonPos != StringRef::npos)
+        FrameStr = FrameStr.substr(ColonPos + 1);
+      FrameStr.consume_front("0x");
----------------
aaupov wrote:

I don't intend to add 0x to stack addresses (reverted that from the test), but yes, this code can handle both `addr` and `0xaddr` as you pointed out.

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


More information about the llvm-branch-commits mailing list