[LLVMdev] register allocation problems in trunk with IMPLICIT_DEF

Patrik Hägglund H patrik.h.hagglund at ericsson.com
Tue May 15 00:11:00 PDT 2012


Thanks for the quick respons. Problem solved!

-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Patrik Hägglund H
Sent: den 14 maj 2012 12:44
To: Jakob Stoklund Olesen; Jonas Paulsson
Cc: llvmdev at cs.uiuc.edu
Subject: Re: [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


_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list