[llvm] 863b2c8 - [DAGCombiner] Use SmallDenseMap (NFC) (#79681)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 27 08:46:06 PST 2024


Author: Kazu Hirata
Date: 2024-01-27T08:46:02-08:00
New Revision: 863b2c84c0fbcfb02d969fa36af4932d410a827b

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

LOG: [DAGCombiner] Use SmallDenseMap (NFC) (#79681)

The use of SmallDenseMap saves 0.48% of heap allocations during the
compilation of a large preprocessed file, namely X86ISelLowering.cpp,
for the X86 target.  During the experiment, the maximum size of
WorklistMap was 24 or less 74% of the time.  (Note that DenseMap has
the maximum occupancy rate of 3/4.)

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 87184fe409eade..ab572c5eca7399 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -174,7 +174,7 @@ namespace {
     /// This is used to find and remove nodes from the worklist (by nulling
     /// them) when they are deleted from the underlying DAG. It relies on
     /// stable indices of nodes within the worklist.
-    DenseMap<SDNode *, unsigned> WorklistMap;
+    SmallDenseMap<SDNode *, unsigned, 32> WorklistMap;
 
     /// This records all nodes attempted to be added to the worklist since we
     /// considered a new worklist entry. As we keep do not add duplicate nodes


        


More information about the llvm-commits mailing list