[llvm] [memprof] Add YAML read/write support to llvm-profdata (PR #118915)

via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 6 11:56:20 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 36c294013cbb4ef46dfd652df1ea0bff5d20462d 13e6da8e81421d0b03bf996b6e1059898663f961 --extensions h,cpp -- llvm/include/llvm/ProfileData/InstrProfReader.h llvm/include/llvm/ProfileData/MemProfReader.h llvm/lib/ProfileData/InstrProfReader.cpp llvm/lib/ProfileData/MemProfReader.cpp llvm/tools/llvm-profdata/llvm-profdata.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/include/llvm/ProfileData/MemProfReader.h b/llvm/include/llvm/ProfileData/MemProfReader.h
index 70e48bbea0..43a3fe4e3b 100644
--- a/llvm/include/llvm/ProfileData/MemProfReader.h
+++ b/llvm/include/llvm/ProfileData/MemProfReader.h
@@ -220,8 +220,8 @@ public:
   // a raw binary memprof profile.
   static bool hasFormat(const StringRef Path);
 
-  // Create a YAMLMemProfReader after sanity checking the contents of the file at
-  // \p Path or the \p Buffer.
+  // Create a YAMLMemProfReader after sanity checking the contents of the file
+  // at \p Path or the \p Buffer.
   static Expected<std::unique_ptr<YAMLMemProfReader>> create(const Twine &Path);
   static Expected<std::unique_ptr<YAMLMemProfReader>>
   create(std::unique_ptr<MemoryBuffer> Buffer);
diff --git a/llvm/lib/ProfileData/InstrProfReader.cpp b/llvm/lib/ProfileData/InstrProfReader.cpp
index d2ff10bd1d..cac1760d3e 100644
--- a/llvm/lib/ProfileData/InstrProfReader.cpp
+++ b/llvm/lib/ProfileData/InstrProfReader.cpp
@@ -1666,7 +1666,8 @@ IndexedMemProfReader::getMemProfCallerCalleePairs() const {
 
 memprof::AllMemProfData IndexedMemProfReader::getAllMemProfData() const {
   memprof::AllMemProfData AllMemProfData;
-  AllMemProfData.HeapProfileRecords.reserve(MemProfRecordTable->getNumEntries());
+  AllMemProfData.HeapProfileRecords.reserve(
+      MemProfRecordTable->getNumEntries());
   for (uint64_t Key : MemProfRecordTable->keys()) {
     auto Record = getMemProfRecord(Key);
     if (Record.takeError())

``````````

</details>


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


More information about the llvm-commits mailing list