[LLVMdev] need some help to remove a dummy mov
    Rafael EspĂndola 
    rafael.espindola at gmail.com
       
    Thu Aug  3 10:12:55 PDT 2006
    
    
  
I have just added a retflag to the ARM backend. I thought that using
BRIND directly was to blame for a dummy move. But I the move wasn't
removed.
When compiling
---------------------------------------
int %g() {
entry:
        call void %f( )
        ret int 42
}
declare void %f()
--------------------------------------
The ARM backend produces
-------------------------------------------
g:
        sub r13, r13, #4
        str r14, [r13]
        mov r4, #42
        bl f
        mov r0, r4
        ldr r14, [r13, #0]
        add r13, r13, #4
        bx r14
------------------------------------------
It would be better to do a "mov r0, #42" directly. The isel dag is
almost identical to the one generated for ppc32, but on ppc32 "li r3,
42" is used.
I have checked that isMoveInstr returns true for the "mov r0,r 4".
Does someone has any idea why the additional mov is generated?
Thanks,
Rafael
    
    
More information about the llvm-dev
mailing list