[llvm-branch-commits] [llvm-profgen] Support [buildid:]0xaddr format in perfscript input (PR #190863)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Apr 7 17:10:16 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");
----------------
HighW4y2H3ll wrote:

Are we adding extra "0x" to the stack addresses? it looks like `consume_front` simply returns if the prefix doesn't match, so it should be compatible with the current inputs..

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


More information about the llvm-branch-commits mailing list