[PATCH] D58073: [GlobalISel][NFC]: Add interface to reserve memory in GISelWorklist
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 11 15:08:06 PST 2019
arsenm added inline comments.
================
Comment at: lib/CodeGen/GlobalISel/Combiner.cpp:115
+ unsigned MF_Size = 0;
+ for (auto &MBB : MF)
+ MF_Size += MBB.size();
----------------
aditya_nandakumar wrote:
> aditya_nandakumar wrote:
> > paquette wrote:
> > > arsenm wrote:
> > > > It seems weird to me to scan over the function just to estimate this. Can you start with some large constant and increase with each block as it's seen?
> > > `MF.getInstructionCount()` does this
> > What according to you is a large constant? Also could you elaborate on what you mean by increase with each block as it's seen? IIUC are you suggesting NumBlocks * some_large_constant?
> Didn't know it existed. Will change to it.
Well both the number of blocks and count of instructions in the block are scans of the entire linked lists IIRC. You could update the estimate at the end of the loop when you can know how many instructions are around. I don't know if it matters. If I were to randomly pick an initial number I would guess thousands?
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58073/new/
https://reviews.llvm.org/D58073
More information about the llvm-commits
mailing list