[LLVMbugs] [Bug 711] NEW: Coallescing physregs with virtregs should allow spilling the virtreg portion

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Feb 22 23:50:35 PST 2006


http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=711

           Summary: Coallescing physregs with virtregs should allow spilling
                    the virtreg portion
           Product: libraries
           Version: 1.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sabre at nondot.org


This problem is causing fastcc on x86 to fail in some corner cases.  Here's a testcase:

---
target endian = little
target pointersize = 32
target triple = "i686-pc-linux-gnu"
%.str_28 = external global [24 x sbyte]		; <[24 x sbyte]*> [#uses=1]

implementation   ; Functions:

fastcc void %apply_stencil_op_to_pixels(int* %tmp.414, uint %n, 
int* %x, int* %y, uint %oper, ubyte* %mask) {
entry:
	switch uint %oper, label %label.5 [
		 uint 5386, label %label.6
	]

label.5:		; preds = %entry
	br label %no_exit.8

no_exit.8:		; preds = %then.17, %label.5
	%tmp.409 = getelementptr ubyte* %mask, uint 0		; <ubyte*> [#uses=1]
	%tmp.410 = load ubyte* %tmp.409		; <ubyte> [#uses=0]
	br label %then.17

then.17:		; preds = %no_exit.8
	%tmp.415 = load int* %tmp.414
	%tmp.417 = load ubyte** null		; <ubyte*> [#uses=1]
	%tmp.425 = getelementptr int* %y, uint 0		; <int*> [#uses=1]
	%tmp.426 = load int* %tmp.425		; <int> [#uses=1]
	%tmp.437 = getelementptr ubyte* %tmp.417, int %tmp.426
		; <ubyte*> [#uses=2]
	%tmp.440 = load ubyte* %tmp.437		; <ubyte> [#uses=1]
	store ubyte %tmp.440, ubyte* %tmp.437
	%tmp.405101 = setlt uint 0, %n		; <bool> [#uses=1]
	br bool %tmp.405101, label %no_exit.8, label %UnifiedReturnBlock

label.6:		; preds = %entry
	%tmp.4.i = tail call uint %fwrite( sbyte* getelementptr ([24 x sbyte]* %.str_28, int 0, int 0), uint 23, 
uint 1, sbyte* null )		; <uint> [#uses=0]
	ret void

UnifiedReturnBlock:		; preds = %then.17, %no_exit.8
	ret void
}

declare int %fprintf(%struct._IO_FILE*, sbyte*, ...)

declare uint %fwrite(sbyte*, uint, uint, sbyte*)
---

Compiled with 'llc -enable-x86-fastcc', this crashes llc.

This is due to the coallescer coallescing virtregs with both EAX and EDX, which makes them unavailable 
to satisfy spills, causing the RA to run out of registers.  We want to coallesce physregs when possible, 
but we cannot pin them in the spiller: we have to be able to uncoallesce them.

This is almost certainly related to Bug 699.

-Chris



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




More information about the llvm-bugs mailing list