[llvm] [MemProf] Use radix tree for alloc contexts in bitcode summaries (PR #117066)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 20 23:28:04 PST 2024
================
@@ -7544,6 +7550,45 @@ void ModuleSummaryIndexBitcodeReader::parseTypeIdCompatibleVtableSummaryRecord(
parseTypeIdCompatibleVtableInfo(Record, Slot, TypeId);
}
+SmallVector<unsigned> ModuleSummaryIndexBitcodeReader::parseAllocInfoContext(
+ ArrayRef<uint64_t> Record, unsigned &I) {
+ SmallVector<unsigned> StackIdList;
+ // For backwards compatibility with old format before radix tree was
+ // used, simply see if we found a radix tree array record.
+ if (RadixArray.empty()) {
+ unsigned NumStackEntries = Record[I++];
+ assert(Record.size() - I >= NumStackEntries);
+ for (unsigned J = 0; J < NumStackEntries; J++) {
----------------
kazutakahirata wrote:
I understand that you are copying this block of code from elsewhere, but may I suggest `reserve` here?
```suggestion
StackIdList.reserve(NumStackEntries);
for (unsigned J = 0; J < NumStackEntries; J++) {
```
https://github.com/llvm/llvm-project/pull/117066
More information about the llvm-commits
mailing list