[LLVMdev] Coalescing and VNInfo

David Greene dag at cray.com
Tue Sep 25 11:28:47 PDT 2007


On Tuesday 25 September 2007 12:25, Evan Cheng wrote:
> LLVM is assuming this:
>      struct InstrSlots {
>        enum {
>          LOAD  = 0,
>          USE   = 1,
>          DEF   = 2,
>          STORE = 3,
>          NUM   = 4
>        };
>
> So VNI->def is always modulo 2. For coalescing, it's checking if the
> RHS is live at the "use" cycle. So it's checking VNI->def-1.

But why is it looking at a use slot in this case, where the coalescer is
trying to get the vaue number for the def of the RHS register so it can
use that value number in the resulting merged live interval?

The comment at the top of the loop is:

00695     // Loop over the value numbers of the LHS, seeing if any are defined 
from
00696     // the RHS.

As I understyand it, it's looking for def-use chains from the RHS interval to
the LHS interval.

That says to me that it's looking for defs of the RHS value, not uses.  Why 
should it expect that a value number defined in some live interval would also 
be used in that live interval at the use slot *before* the def?

What am I missing?

                                                      -Dave



More information about the llvm-dev mailing list