Skip to content

Commit 482e7dc

Browse files
[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.
1 parent 718fbcb commit 482e7dc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/include/llvm/IR/ModuleSummaryIndex.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1343,7 +1343,7 @@ class ModuleSummaryIndex {
13431343

13441344
/// Mapping from original ID to GUID. If original ID can map to multiple
13451345
/// GUIDs, it will be mapped to 0.
1346-
std::map<GlobalValue::GUID, GlobalValue::GUID> OidGuidMap;
1346+
DenseMap<GlobalValue::GUID, GlobalValue::GUID> OidGuidMap;
13471347

13481348
/// Indicates that summary-based GlobalValue GC has run, and values with
13491349
/// GVFlags::Live==false are really dead. Otherwise, all values must be

0 commit comments

Comments
 (0)