[PATCH] Fix PR target/10282

Jan Hubicka jh@suse.cz
Fri Apr 11 22:52:00 GMT 2003


> Hi,
> 
> This is a regression from gcc 3.2.2 present on 3.3 and mainline. We ICE 
> during reload on the attached testcase:
> 
> x.c: In function `foo':
>     x.c:17: error: unable to find a register to spill in class `Q_REGS'
>     x.c:17: error: this is the insn:
>     (insn 22 20 24 0 0x40153268 (set (mem:QI (plus:SI (subreg:SI (reg/v:DI 63 
> [ Ld2 ]) 0)
>                     (subreg:SI (reg/v:DI 62 [ Ld1 ]) 4)) [0 S1 A8])
>             (subreg:QI (reg/v:SI 4 esi [orig:61 Ll ] [61]) 0)) 48 {*movqi_1} 
> (insn_list 18 (insn_list 20 (nil)))
>         (expr_list:REG_DEAD (reg/v:SI 4 esi [orig:61 Ll ] [61])
>             (expr_list:REG_DEAD (reg/v:DI 62 [ Ld1 ])
>                 (nil))))
>     x.c:17: internal compiler error: in spill_failure, at reload1.c:1917
> 
> 
> The subreg
> 
> 	(subreg:QI (reg/v:SI 4 esi [orig:61 Ll ] [61]) 0)
> 
> is obviously invalid. It is generated because pseudo-reg 61 has Q_REGS as its 
> preferred reload class and GENERAL_REGS as its alternate class.
> 
> I played with the new approach that consists in trying to prevent such 
> invalid subregs from being generated with CANNOT_CHANGE_MODE_CLASS. This 
> appears to work here.

This will somewhat pesimize code as some instruction patterns allow
QImode operations in NON_Q_REGS - like addition can be done via full
sized operation.

Why reload didn't managed to find the Q register in the testcase?

Honza
> 
> Bootstrapped/regtested on i586-redhat-linux-gnu (c,c++,objc,f77 3.3 branch), 
> bootstrapped on i586-redhat-linux-gnu (c,c++,objc,f77 mainline), regtesting 
> in progress.
> 
> -- 
> Eric Botcazou
> 
> 
> 2003-04-11  Eric Botcazou  <ebotcazou@libertysurf.fr>
> 
> 	* config/i386/i386.h (MAYBE_NON_Q_CLASS_P): New macro.
> 	(MAYBE_FLOAT_SSE_CLASS_P): New macro.
> 	(CANNOT_CHANGE_MODE_CLASS): Use them. Forbid mode shrinking
> 	to QImode and HImode when the class contains non NON_Q_REGS.
> 
> 
> 2003-04-11  Eric Botcazou  <ebotcazou@libertysurf.fr>
> 
> 	* gcc.c-torture/compile/20030411-1.c: New test.




More information about the Gcc-patches mailing list