aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-11-14 17:28:56 -0800
committerGitHub <noreply@github.com>2024-11-14 17:28:56 -0800
commit17bc738324274f1cf54d30552d65751d216e7ad0 (patch)
tree1a69c454910a46c53499c8406e5adabd18fe659f
parent40a647fc7dc6048c92e2d580b61f5feca0785980 (diff)
downloadllvm-17bc738324274f1cf54d30552d65751d216e7ad0.zip
llvm-17bc738324274f1cf54d30552d65751d216e7ad0.tar.gz
llvm-17bc738324274f1cf54d30552d65751d216e7ad0.tar.bz2
[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.
-rw-r--r--llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
index 353dc00..a37e888 100644
--- a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
+++ b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
@@ -247,6 +247,10 @@ public:
// recursion.
bool Recursive = false;
+ // This will be formed by ORing together the AllocationType enum values
+ // for contexts including this node.
+ uint8_t AllocTypes = 0;
+
// The corresponding allocation or interior call. This is the primary call
// for which we have created this node.
CallInfo Call;
@@ -255,7 +259,7 @@ public:
// through cloning. I.e. located in the same function and have the same
// (possibly pruned) stack ids. They will be updated the same way as the
// primary call when assigning to function clones.
- std::vector<CallInfo> MatchingCalls;
+ SmallVector<CallInfo, 0> MatchingCalls;
// For alloc nodes this is a unique id assigned when constructed, and for
// callsite stack nodes it is the original stack id when the node is
@@ -266,10 +270,6 @@ public:
// clones.
uint64_t OrigStackOrAllocId = 0;
- // This will be formed by ORing together the AllocationType enum values
- // for contexts including this node.
- uint8_t AllocTypes = 0;
-
// Edges to all callees in the profiled call stacks.
// TODO: Should this be a map (from Callee node) for more efficient lookup?
std::vector<std::shared_ptr<ContextEdge>> CalleeEdges;