Hi Vlad, Thanks for the answer.
Vladimir Makarov <vmaka...@redhat.com> writes: > On 05/28/2012 03:09 PM, Richard Sandiford wrote: >> Or is it a conceptual part of the algorithm? > No. >> More generally, >> what kind of situations does the second pass help with? > I can not show such situations right now but I did some benchmarking > long ago on the old RA and the second pass is really important for > better code generation. That time I even thought about 3rd pass for > -O3. I don't think the situation is now different. > > Cost pass is a complicated part. It is impossible to find some good > literature which could help. The problem is in GCC compiler specifics > when code selection is not done (at least fully) before RA and we don't > know until reload end what alternative will be used. So some code > selection is done in combiner, some in IRA (including cost pass by > defining allocation classes for pseudos) and final code selection is > done in reload. Understood. But I wasn't sure what the second pass was actually trying to do, or more specifically, how it was expected to give different results from the first pass. Most other parts of IRA are well commented and describe what the code is trying to do (with as you say the usual caveat that this is always going to be a heuristic, and may not be taken directly from the literature). But I couldn't see a similar comment describing how the second pass worked and what it was trying to do. I'd be happy to add one myself, but I haven't worked it out yet :-) Richard