[llvm-dev] Saving Compile Time in InstCombine

Chris Lattner via llvm-dev llvm-dev at lists.llvm.org
Sat Apr 15 11:53:10 PDT 2017


On Apr 13, 2017, at 8:27 PM, Daniel Berlin via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> Out of 35% InstCombine time, about half is spent in the top 5 visitor routines.
> 
> I wanted to see what transformations InstCombine actually performs. Using -debug option turned out not to be very scalable. Never mind the large output size of the trace, running "opt -debug -instcombineā€¯
> 
> on anything other than a small IR is excruciatingly slow. Out of curiosity I profiled it too: 96% of the time is spent decoding and printing instructions. Is this a known problem?
> 
> Yes
> 
> The problem is *every* value print call builds an assembly writer, which  calls the module typefinder to be able to print the types.  This walks everything in the module to find the types.
> For large ir with a lot of types, this is *ridiculously* slow.
> 
> IE it's basically processing a large part of the module for *every operand* it prints.
> 
> You can, for something like what you are doing, just hack it up to build it once or not at all.
> 
> I've never understood why this doesn't annoy people more :)
> 
> As a hack, you can comment out AsmWriter.cpp:2137

You can just create a ModuleSlotTracker and pass it back into the print functions.

-Chris



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170415/b8a4ed60/attachment.html>


More information about the llvm-dev mailing list