[llvm] [memprof] Make ContextNode smaller (PR #116271)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 14 14:09:08 PST 2024
https://github.com/kazutakahirata updated https://github.com/llvm/llvm-project/pull/116271
>From 8e954ab8e41e873be0ca1c7ecc8e430487d57a47 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 4 Jun 2024 22:50:59 -0700
Subject: [PATCH 1/2] [memprof] Make ContextNode smaller
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.
---
.../Transforms/IPO/MemProfContextDisambiguation.cpp | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
index 353dc00c9928e1..a37e888cc04bc7 100644
--- a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
+++ b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
@@ -247,6 +247,10 @@ class CallsiteContextGraph {
// 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 @@ class CallsiteContextGraph {
// 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 @@ class CallsiteContextGraph {
// 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;
>From 70a82189349ac0f095d208b394763688587942a4 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 14 Nov 2024 14:08:54 -0800
Subject: [PATCH 2/2] Trigger build
More information about the llvm-commits
mailing list