Skip to content

Commit a61048b

Browse files
authored
[MemProf][NFC] Hoist size computation out of the loop for v3 (#137479)
Similar to the suggestion in #137394. In this case apply it to the current binary format (v3).
1 parent 45411ac commit a61048b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/ProfileData/MemProf.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,13 @@ static IndexedMemProfRecord deserializeV3(const MemProfSchema &Schema,
190190
const uint64_t NumNodes =
191191
endian::readNext<uint64_t, llvm::endianness::little>(Ptr);
192192
Record.AllocSites.reserve(NumNodes);
193+
const size_t SerializedSize = PortableMemInfoBlock::serializedSize(Schema);
193194
for (uint64_t I = 0; I < NumNodes; I++) {
194195
IndexedAllocationInfo Node;
195196
Node.CSId =
196197
endian::readNext<LinearCallStackId, llvm::endianness::little>(Ptr);
197198
Node.Info.deserialize(Schema, Ptr);
198-
Ptr += PortableMemInfoBlock::serializedSize(Schema);
199+
Ptr += SerializedSize;
199200
Record.AllocSites.push_back(Node);
200201
}
201202

0 commit comments

Comments
 (0)