[llvm] [MemProf][NFC] Switch to DenseMaps (PR #93868)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Thu May 30 12:48:52 PDT 2024


https://github.com/teresajohnson created https://github.com/llvm/llvm-project/pull/93868

Change a couple of maps from std::map to DenseMap, which showed
a modest (3.6%) reduction in peak RSS.

>From 49e4ba61971f3f65bf7e5169b747ae0486fac991 Mon Sep 17 00:00:00 2001
From: Teresa Johnson <tejohnson at google.com>
Date: Thu, 30 May 2024 12:45:17 -0700
Subject: [PATCH] [MemProf][NFC] Switch to DenseMaps

Change a couple of maps from std::map to DenseMap, which showed
a modest (3.6%) reduction in peak RSS.
---
 llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
index c53b9451625c6..0512922e35ae9 100644
--- a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
+++ b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
@@ -552,13 +552,13 @@ class CallsiteContextGraph {
                       const DenseSet<uint32_t> &AllocContextIds);
 
   /// Map from each context ID to the AllocationType assigned to that context.
-  std::map<uint32_t, AllocationType> ContextIdToAllocationType;
+  DenseMap<uint32_t, AllocationType> ContextIdToAllocationType;
 
   /// Identifies the context node created for a stack id when adding the MIB
   /// contexts to the graph. This is used to locate the context nodes when
   /// trying to assign the corresponding callsites with those stack ids to these
   /// nodes.
-  std::map<uint64_t, ContextNode *> StackEntryIdToContextNodeMap;
+  DenseMap<uint64_t, ContextNode *> StackEntryIdToContextNodeMap;
 
   /// Maps to track the calls to their corresponding nodes in the graph.
   MapVector<CallInfo, ContextNode *> AllocationCallToContextNodeMap;



More information about the llvm-commits mailing list