Added an interface to specify how many elements to reserve to GISelWorkList.
This change resulted in a 12% compile time improvement in the combiner pass(es), and 2.5% improvement in the legalizer.
Details
Diff Detail
Event Timeline
lib/CodeGen/GlobalISel/Combiner.cpp | ||
---|---|---|
115 | 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? |
lib/CodeGen/GlobalISel/Combiner.cpp | ||
---|---|---|
115 | 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? |
lib/CodeGen/GlobalISel/Combiner.cpp | ||
---|---|---|
115 | I just realized that in the combiner it's silly that we're recomputing this for every loop - I'm not sure if your original comment was addressing that or in general about traversing linked lists even once (I assumed it was the latter). I also don't think it matters if we care about the exact size during each iteration - if we're doing the full list traversal, I'll definitely move this out of the main loop and use an old estimate. |
lib/CodeGen/GlobalISel/Combiner.cpp | ||
---|---|---|
115 | I think that ilist's size() is a linear time linked list walk. |
Changed the strategy to fix problems of DenseMap migration as well as silly traversals of MachineFunction just to estimate the size.
include/llvm/CodeGen/GlobalISel/GISelWorkList.h | ||
---|---|---|
88–89 | Clang format does not do that for me. |
size_t