Hello folks,<div><br></div><div>I'm sure this has been asked many times, but is there current work on decreasing the time taken by the DAG-based instruction selector, or the other phases of llc? I am just beginning to dive into LLVM, and I am interested in compile-time reductions that do not reduce code quality dramatically. For example, simply switching on "-fast-isel" (roughly 17% drop in code quality for some of my benchmarks) or "-regalloc=local/fast" (roughly 2x slower for some of my benchmarks) is, unfortunately, not an acceptable option.</div>


<div><br></div><div>I noticed that a semi-recent commit added the "STATISTIC(NumDAGIselRetries,"Number of times dag isel has to try another path");" as well as a sorting change in DAGISelEmitter.cpp. This suggests to me that there is work being done. Are there other similar efforts, but perhaps aiming for bigger gains, that I should be aware of? From the other end, are there efforts to make the fast-path produce better quality code?</div>


<div><br></div><div>Some small things I've noticed:</div><div><br></div><div> - LegalizeVectors might not make a single change over an entire input bc file, yet it can take about 6% of the ISel time. Identifying that this can be skipped ahead of time may help?</div>


<div> - We can take the Changed flag returned by LegalizeVectors, and pass it on to Legalize so that it can decide not to AssignTopologicalOrder again, since it was already done in the LegalizeVectors pass. However, this is a negligible reduction: 0.2 seconds shaved off a 30+ second compile =).</div>


<div> - BuildSchedGraph() can take around 30% of the X% of time taken by Instruction Scheduling. How different is the scheduler graph from the selection graph?</div><div> - Just as a random guess that this would not affect code quality terribly, I tried dynamically switching on -fast-isel for basic blocks of size one. This can cover about 10% of the basic blocks. The code-quality drop on a few benchmarks is neglible, but for spec's 483.xalancbmk it is quite dramatic.</div>

<div><br></div><div>Also, any pointers to documentation, or description of the algorithm used by the Select() -> SelectCode() -> SelectCodeCommon() pass would be very helpful.</div>

<div><br></div><div>Sorry for the long email, and many thanks in advance!</div><div><br></div><div>- Jan Voung</div>