[LLVMdev] Unnecessary moves after sign-extension in 2-address target

Greg McGary greg at mcgary.org
Tue Apr 21 13:59:15 PDT 2009


Greg McGary wrote:
> ********** REWRITING TWO-ADDR INSTRS **********
> ********** Function: sext
>     %reg1028<def> = sextb_r %reg1025<kill>
>         prepend:    %reg1028<def> = mov_rr %reg1025<kill>
>         rewrite to:    %reg1028<def> = sextb_r %reg1028
> ...
>     %reg1030<def> = sextw_r %reg1026<kill>
>         prepend:    %reg1030<def> = mov_rr %reg1026<kill>
>         rewrite to:    %reg1030<def> = sextw_r %reg1030
>
> Because sextb_r and sextw_r have destination tied to source operands,
> TwoAddressInstructionPass thinks it needs a copy.  However, since the
> sext kills its source, the copy is unnecessary.  Why does this happen?
> Is TwoAddressInstructionPass relying on a later pass to notice this and
> transform it again?
>   

Since no one responded, I'll assume that this situation doesn't ring a
bell with anyone, so I'll need to dig deeper...

G




More information about the llvm-dev mailing list