Skip to content

Commit 17bc738

Browse files
[memprof] Make ContextNode smaller (#116271)
With this patch, sizeof(ContextNode) goes down from 144 to 128. Note that SmallVector<T, 0> uses uint32_t for its capacity and size fields. I could change other instances of std::vector to SmallVector<T, 0>, but that would require updates to many places, so I am leaving them alone for now.
1 parent 40a647f commit 17bc738

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@ class CallsiteContextGraph {
247247
// recursion.
248248
bool Recursive = false;
249249

250+
// This will be formed by ORing together the AllocationType enum values
251+
// for contexts including this node.
252+
uint8_t AllocTypes = 0;
253+
250254
// The corresponding allocation or interior call. This is the primary call
251255
// for which we have created this node.
252256
CallInfo Call;
@@ -255,7 +259,7 @@ class CallsiteContextGraph {
255259
// through cloning. I.e. located in the same function and have the same
256260
// (possibly pruned) stack ids. They will be updated the same way as the
257261
// primary call when assigning to function clones.
258-
std::vector<CallInfo> MatchingCalls;
262+
SmallVector<CallInfo, 0> MatchingCalls;
259263

260264
// For alloc nodes this is a unique id assigned when constructed, and for
261265
// callsite stack nodes it is the original stack id when the node is
@@ -266,10 +270,6 @@ class CallsiteContextGraph {
266270
// clones.
267271
uint64_t OrigStackOrAllocId = 0;
268272

269-
// This will be formed by ORing together the AllocationType enum values
270-
// for contexts including this node.
271-
uint8_t AllocTypes = 0;
272-
273273
// Edges to all callees in the profiled call stacks.
274274
// TODO: Should this be a map (from Callee node) for more efficient lookup?
275275
std::vector<std::shared_ptr<ContextEdge>> CalleeEdges;

0 commit comments

Comments
 (0)