[llvm] 482e7dc - [ThinLTO] Use DenseMap for OidGuidMap (#107725)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 7 18:15:28 PDT 2024
Author: Kazu Hirata
Date: 2024-09-07T18:15:24-07:00
New Revision: 482e7dc67b7de22a47aff63eda1dd719cda86267
URL: https://github.com/llvm/llvm-project/commit/482e7dc67b7de22a47aff63eda1dd719cda86267
DIFF: https://github.com/llvm/llvm-project/commit/482e7dc67b7de22a47aff63eda1dd719cda86267.diff
LOG: [ThinLTO] Use DenseMap for OidGuidMap (#107725)
We use OidGuidMap only to map an old GUID to a new one. We don't use
std::set's strengths like iterators staying valid or the ability to
traverse in a sorted order.
As a data point, during the ThinLTO indexing step of a large
application of ours, we create 440,000 mappings. Our memory profiler
reports reduction of 127MB in the peak memory usage (out of 4.991GB),
which is bigger than expected savings most likely due to some noise.
The savings should be about 8MB at the max load factor of DenseMap.
Added:
Modified:
llvm/include/llvm/IR/ModuleSummaryIndex.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index af3734cc2c54b5..dae208d0b132e4 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -1343,7 +1343,7 @@ class ModuleSummaryIndex {
/// Mapping from original ID to GUID. If original ID can map to multiple
/// GUIDs, it will be mapped to 0.
- std::map<GlobalValue::GUID, GlobalValue::GUID> OidGuidMap;
+ DenseMap<GlobalValue::GUID, GlobalValue::GUID> OidGuidMap;
/// Indicates that summary-based GlobalValue GC has run, and values with
/// GVFlags::Live==false are really dead. Otherwise, all values must be
More information about the llvm-commits
mailing list