[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 17:07:14 PST 2019


aditya_nandakumar marked an inline comment as done.
aditya_nandakumar added inline comments.


================
Comment at: include/llvm/CodeGen/GlobalISel/GISelWorkList.h:32
 class GISelWorkList {
   SmallVector<MachineInstr *, N> Worklist;
   DenseMap<MachineInstr *, unsigned> WorklistMap;
----------------
arsenm wrote:
> aditya_nandakumar wrote:
> > arsenm wrote:
> > > If this matters, should this even be a SmallVector?
> > Could you elaborate? Are you implying we replace this with something else (std::vector) or implying that the template parameter is probably not needed and we can always runtime reserve the size once..
> Yes, if this is is big, there's no reason for the reserved small size so std::vector
I thought I'd run some numbers just to be sure (the 512 number we use in most places is quite arbitrary) - however we do use the GISelWorkList in some passes (out of tree) for collecting some intermediate instructions, and it's set to 16 (and we avoid heap).
Either way, I can change that (and add the interface to reserve) in a subsequent patch.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57931/new/

https://reviews.llvm.org/D57931





More information about the llvm-commits mailing list