[PATCH] D130563: Skip padding between buildid and filenames.

Krzysztof Pszeniczny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 26 05:21:58 PDT 2022


amharc created this revision.
Herald added a reviewer: rafauler.
Herald added a subscriber: ayermolo.
Herald added a reviewer: Amir.
Herald added a reviewer: maksfb.
Herald added a project: All.
amharc published this revision for review.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.

The perf tool will left-pad the buildids to 40 characters[1] and some
buildid types supported by lld are shorter than that (e.g. md5 is only
32 characters long).

[1]
https://github.com/torvalds/linux/blob/7b58b82b86c8b65a2b57a4c6cb96a460654f9e09/tools/perf/util/dsos.c#L308


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130563

Files:
  bolt/lib/Profile/DataAggregator.cpp
  bolt/unittests/Profile/DataAggregator.cpp


Index: bolt/unittests/Profile/DataAggregator.cpp
===================================================================
--- bolt/unittests/Profile/DataAggregator.cpp
+++ bolt/unittests/Profile/DataAggregator.cpp
@@ -41,11 +41,14 @@
 
   StringRef AllValidBuildIDs = "0000 File0\n"
                                "1111 File1\n"
-                               "2222 File2\n";
+                               "2222 File2\n"
+                               "333  File3\n";
   DA.setParsingBuffer(AllValidBuildIDs);
   ASSERT_TRUE(DA.hasAllBuildIDs());
   FileName = DA.getFileNameForBuildID("1234");
   ASSERT_FALSE(FileName);
   FileName = DA.getFileNameForBuildID("2222");
   ASSERT_EQ(*FileName, "File2");
+  FileName = DA.getFileNameForBuildID("333");
+  ASSERT_EQ(*FileName, "File3");
 }
Index: bolt/lib/Profile/DataAggregator.cpp
===================================================================
--- bolt/lib/Profile/DataAggregator.cpp
+++ bolt/lib/Profile/DataAggregator.cpp
@@ -2144,6 +2144,8 @@
   if (std::error_code EC = BuildIDStr.getError())
     return NoneType();
 
+  consumeAllRemainingFS();
+
   // If one of the strings is missing, don't issue a parsing error, but still
   // do not return a value.
   if (ParsingBuf[0] == '\n')


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130563.447651.patch
Type: text/x-patch
Size: 1246 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220726/a1cfb128/attachment.bin>


More information about the llvm-commits mailing list