[llvm] [MemProf][NFC] Hoist size computation out of the loop for v3 (PR #137479)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 26 15:50:45 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-pgo
Author: Snehasish Kumar (snehasish)
<details>
<summary>Changes</summary>
Similar to the suggestion in #<!-- -->137394. In this case apply it to the current binary format (v3).
---
Full diff: https://github.com/llvm/llvm-project/pull/137479.diff
1 Files Affected:
- (modified) llvm/lib/ProfileData/MemProf.cpp (+2-1)
``````````diff
diff --git a/llvm/lib/ProfileData/MemProf.cpp b/llvm/lib/ProfileData/MemProf.cpp
index 0af08ca51481f..1e956250e5b84 100644
--- a/llvm/lib/ProfileData/MemProf.cpp
+++ b/llvm/lib/ProfileData/MemProf.cpp
@@ -190,12 +190,13 @@ static IndexedMemProfRecord deserializeV3(const MemProfSchema &Schema,
const uint64_t NumNodes =
endian::readNext<uint64_t, llvm::endianness::little>(Ptr);
Record.AllocSites.reserve(NumNodes);
+ const size_t SerializedSize = PortableMemInfoBlock::serializedSize(Schema);
for (uint64_t I = 0; I < NumNodes; I++) {
IndexedAllocationInfo Node;
Node.CSId =
endian::readNext<LinearCallStackId, llvm::endianness::little>(Ptr);
Node.Info.deserialize(Schema, Ptr);
- Ptr += PortableMemInfoBlock::serializedSize(Schema);
+ Ptr += SerializedSize;
Record.AllocSites.push_back(Node);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/137479
More information about the llvm-commits
mailing list