[LLVMdev] register allocation problems in trunk with IMPLICIT_DEF

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed May 9 09:21:00 PDT 2012


On May 9, 2012, at 6:27 AM, Jonas Paulsson <jonas.paulsson at ericsson.com> wrote:

> Hi,
>  
> Recently code using IMPLICIT_DEF and INSERT_SUBREG started to break:
>  
>             %vreg9<def> = IMPLICIT_DEF
>             %vreg10<def> = INSERT_SUBREG %vreg9<kill>, %vreg1<kill>, hi
>             %vreg12<def> = sub %vreg10<kill>, %vreg11<kill>
> =>
>             %vreg10<def> = IMPLICIT_DEF
>             %vreg10:hi<def> = COPY %vreg1<kill>
>             %vreg12<def> = sub %vreg10<kill>, %vreg11<kill>
> =>
>             %vreg10:hi<def,read-undef> = COPY %vreg1<kill>, %vreg10<imp-def>
>             %vreg12<def> = sub %vreg10<kill>, %vreg11<kill>
> =>
>             %vreg10:hi<def,read-undef> = COPY %a1_h<kill>
>             %vreg12<def> = sub %vreg10<kill>, %vreg11<kill>
> =>
>             %a2_h<def> = COPY %a1_h<kill>
>             %a2<def> = sub %a2<kill>, %a3<kill>
>  
> *** Bad machine code: Using an undefined physical register ***
> - function:    array
> - basic block:  0x43ac7d0 (BB#0)
> - instruction: %a2<def> = sub %a2<kill>, %a3<kill
> - operand 1:   %a2<kill>
>  
> This all worked well before. Is there a change somewhere in the framework that will make the code on top wrong?

This looks like a bug in the register allocator you are using. There should have been an %a2<imp-def> operand added to the copy instruction when rewriting virtual registers to physical registers.

Please file a PR, preferably with a test case for an in-target tree. Don't forget to state which register allocator you are using.

/jakob

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120509/32afe968/attachment.html>


More information about the llvm-dev mailing list