[LLVMdev] Moving between registers of different classes

Vladimir Prus ghost at cs.msu.su
Tue Jul 6 09:43:01 PDT 2004


Suppose I need to align an address register to even boundary. Since address 
register can't be AND-ed with anything, I move the value into general purpose 
register, to "and" and then move it into address register. Unfortunately, the 
register allocator crashes. Here's machine code:

        %reg1030 = - %reg1027, 1
        %reg1031 = move %reg1030
        %reg1032 = + %reg1031, -2
        %reg1033 = move %reg1032
        %ar1 = load64 %gr1<def>, %reg1033

and here's assertion:

llc: LiveIntervals.cpp:507: void llvm::LiveIntervals::joinIntervals(): 
Assertion `rcA == rcB && "registers must be of the same class"' failed.
(gdb) up 4
.....
(gdb) p *intA
$1 = (llvm::LiveInterval &) @0x8064698: {reg = 1030, weight = 0,
........
(gdb) p *intB
$2 = (llvm::LiveInterval &) @0x80646b8: {reg = 1031, weight = 0,
.......

Is there anything I can do to make it work? Actually, it seems like a bug in 
register allocator. If it can't coalesce intervals because there are 
different register classes, it should just leave the move alone, not crash.

- Volodya







More information about the llvm-dev mailing list