[PATCH] D57931: [GISel]: While constructing the GISelWorklist make sure we reserve at least the required size to the underlying dense map.

Aditya Nandakumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 7 16:47:47 PST 2019


aditya_nandakumar created this revision.
aditya_nandakumar added reviewers: arsenm, bogner, aemerson, volkan, qcolombet, paquette, dsanders.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

This should save some unnecessary growing of the DenseMap.

Note: We should also provide a reserve interface to the GISelWorkList which can be runtime initialized to either the template parameter or the number of instructions in the MachineFunction. I can do this in a subsequent patch..


Repository:
  rL LLVM

https://reviews.llvm.org/D57931

Files:
  include/llvm/CodeGen/GlobalISel/GISelWorkList.h


Index: include/llvm/CodeGen/GlobalISel/GISelWorkList.h
===================================================================
--- include/llvm/CodeGen/GlobalISel/GISelWorkList.h
+++ include/llvm/CodeGen/GlobalISel/GISelWorkList.h
@@ -33,7 +33,7 @@
   DenseMap<MachineInstr *, unsigned> WorklistMap;
 
 public:
-  GISelWorkList() {}
+  GISelWorkList() : WorklistMap(N) {}
 
   bool empty() const { return WorklistMap.empty(); }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57931.185889.patch
Type: text/x-patch
Size: 426 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190208/f1d0d707/attachment.bin>


More information about the llvm-commits mailing list