[llvm] bb3ea6c - [MemProf] Switch to DenseMap for performance (NFC) (#81035)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 13:32:13 PST 2024


Author: Teresa Johnson
Date: 2024-02-07T13:32:08-08:00
New Revision: bb3ea6c810ccdffd176589e608bfa79dd25268ff

URL: https://github.com/llvm/llvm-project/commit/bb3ea6c810ccdffd176589e608bfa79dd25268ff
DIFF: https://github.com/llvm/llvm-project/commit/bb3ea6c810ccdffd176589e608bfa79dd25268ff.diff

LOG: [MemProf] Switch to DenseMap for performance (NFC) (#81035)

Some profiling showed that the accesses to this map during bitcode
reading was incurring over 10% of the time in a large thin link. There
is no need for it to be std::map, and I measured around 8.5% time
reduction in the same thin link from switching to 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 395c9e332eb8f3..d5ff15063671d8 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -1377,7 +1377,7 @@ class ModuleSummaryIndex {
 
   // Temporary map while building StackIds list. Clear when index is completely
   // built via releaseTemporaryMemory.
-  std::map<uint64_t, unsigned> StackIdToIndex;
+  DenseMap<uint64_t, unsigned> StackIdToIndex;
 
   // YAML I/O support.
   friend yaml::MappingTraits<ModuleSummaryIndex>;


        


More information about the llvm-commits mailing list