Jonas Paulsson
2012-May-09 13:27 UTC
[LLVMdev] register allocation problems in trunk with IMPLICIT_DEF
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? Jonas -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120509/109a2952/attachment.html>
Jakob Stoklund Olesen
2012-May-09 16:21 UTC
[LLVMdev] register allocation problems in trunk with IMPLICIT_DEF
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>
Patrik Hägglund H
2012-May-14 10:43 UTC
[LLVMdev] register allocation problems in trunk with IMPLICIT_DEF
I used llvm-stress to find a similar problem on x86-64. See http://llvm.org/bugs/show_bug.cgi?id=12821. BTW, llvm-stress is a great tool! /Patrik Hägglund ________________________________ From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Jakob Stoklund Olesen Sent: den 9 maj 2012 18:21 To: Jonas Paulsson Cc: llvmdev at cs.uiuc.edu Subject: Re: [LLVMdev] register allocation problems in trunk with IMPLICIT_DEF 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
Apparently Analagous Threads
- [LLVMdev] register allocation problems in trunk with IMPLICIT_DEF
- [LLVMdev] register allocation problems in trunk with IMPLICIT_DEF
- [LLVMdev] RegisterCoalescing Pass seems to ignore part of CFG.
- [LLVMdev] RegisterCoalescing pass crashes with ImplicitDef registers
- [LLVMdev] Strong vs. default phi elimination and single-reg classes