From 869af98580cdf71069394f9c853b63afa6dfa185 Mon Sep 17 00:00:00 2001 From: Snehasish Kumar Date: Sat, 26 Apr 2025 15:47:00 -0700 Subject: [PATCH] [MemProf][NFC] Hoist size computation out of the loop for v3 --- llvm/lib/ProfileData/MemProf.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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(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(Ptr); Node.Info.deserialize(Schema, Ptr); - Ptr += PortableMemInfoBlock::serializedSize(Schema); + Ptr += SerializedSize; Record.AllocSites.push_back(Node); }