Bug 22258 - [4.1 Regression] combine causes spill failure on return value register
Summary: [4.1 Regression] combine causes spill failure on return value register
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.1.0
: P2 critical
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: build, ice-on-valid-code, patch
Depends on:
Blocks:
 
Reported: 2005-06-30 18:42 UTC by Jorn Wolfgang Rennecke
Modified: 2018-06-28 02:22 UTC (History)
1 user (show)

See Also:
Host:
Target: sh-elf
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-07-02 17:26:19


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jorn Wolfgang Rennecke 2005-06-30 18:42:45 UTC
An sh-elf build fails with:

/mnt/scratch/nightly/2005-06-28/sh-elf/./gcc/xgcc
-B/mnt/scratch/nightly/2005-06-28/sh-elf/./gcc/ -nostdinc
-B/mnt/scratch/nightly/2005-06-28/sh-elf/sh-elf/newlib/ -isystem
/mnt/scratch/nightly/2005-06-28/sh-elf/sh-elf/newlib/targ-include -isystem
/mnt/scratch/nightly/2005-06-28/srcw/newlib/libc/include
-B/usr/local/sh-elf/bin/ -B/usr/local/sh-elf/lib/ -isystem
/usr/local/sh-elf/include -isystem /usr/local/sh-elf/sys-include
-L/mnt/scratch/nightly/2005-06-28/sh-elf/./ld -O2  -DIN_GCC -DCROSS_COMPILE   -W
-Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition  -isystem ./include   -g  -DIN_LIBGCC2
-D__GCC_FLOAT_NOT_NEEDED  -I. -I -I../../srcw/gcc -I../../srcw/gcc/
-I../../srcw/gcc/../include -I../../srcw/gcc/../libcpp/include  -m2a -DL_mulsc3
-c ../../srcw/gcc/libgcc2.c -o libgcc/m2a/_mulsc3.o
../../srcw/gcc/libgcc2.c: In function ‘__mulsc3’:
../../srcw/gcc/libgcc2.c:1685: error: unable to find a register to spill in
class ‘FP0_REGS’
../../srcw/gcc/libgcc2.c:1685: error: this is the insn:
(insn:HI 31 30 45 0 ../../srcw/gcc/libgcc2.c:1685 (parallel [
            (set (reg:SF 65 fr1 [orig:64+4 ] [64])
                (plus:SF (mult:SF (reg/v:SF 68 fr4 [orig:160 a ] [160])
                        (reg/v:SF 71 fr7 [orig:163 d ] [163]))
                    (reg/v:SF 70 fr6 [orig:162 c ] [162])))
            (use (reg/v:PSI 151 ))
        ]) 299 {*macsf3} (insn_list:REG_DEP_TRUE 18 (nil))
    (expr_list:REG_DEAD (reg/v:PSI 151 )
        (expr_list:REG_DEAD (reg/v:SF 68 fr4 [orig:160 a ] [160])
            (expr_list:REG_DEAD (reg/v:SF 71 fr7 [orig:163 d ] [163])
                (expr_list:REG_DEAD (reg/v:SF 70 fr6 [orig:162 c ] [162])
                    (nil))))))
../../srcw/gcc/libgcc2.c:1685: internal compiler error: in spill_failure, at
reload1.c:1889
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make[2]: *** [libgcc/m2a/_mulsc3.o] Error 1
make[2]: Leaving directory `/mnt/scratch/nightly/2005-06-28/sh-elf/gcc'
make[1]: *** [stmp-multilib] Error 2
make[1]: Leaving directory `/mnt/scratch/nightly/2005-06-28/sh-elf/gcc'
make: *** [all-gcc] Error 2
build failed

before combine we have:

(insn 19 18 26 0 ../../srcw/gcc/libgcc2.c:1626 (parallel [
            (set (reg:SF 169)
                (plus:SF (reg:SF 167)
                    (reg:SF 168)))
            (use (reg/v:PSI 151 )) 
        ]) 292 {addsf3_i} (insn_list:REG_DEP_TRUE 17 (insn_list:REG_DEP_TRUE 18
(nil)))
    (expr_list:REG_DEAD (reg:SF 167)
        (expr_list:REG_DEAD (reg:SF 168)
            (nil))))

(note 26 19 27 0 NOTE_INSN_FUNCTION_END)

(note 27 26 29 0 ("../../srcw/gcc/libgcc2.c") 1685)

(insn 29 27 30 0 ../../srcw/gcc/libgcc2.c:1685 (clobber (reg/i:SC 64 fr0)) -1 (nil)
    (expr_list:REG_UNUSED (reg/i:SC 64 fr0)
        (nil)))
    
(insn 30 29 31 0 ../../srcw/gcc/libgcc2.c:1685 (parallel [
            (set (reg:SF 64 fr0 [ <result> ])
                (reg:SF 166))
            (use (reg/v:PSI 151 ))
            (clobber (scratch:SI)) 
        ]) 202 {movsf_ie} (insn_list:REG_DEP_TRUE 16 (nil))
    (expr_list:REG_DEAD (reg:SF 166)
        (expr_list:REG_UNUSED (scratch:SI)
            (nil))))
    
(insn 31 30 36 0 ../../srcw/gcc/libgcc2.c:1685 (parallel [
            (set (reg:SF 65 fr1 [orig:64+4 ] [64])
                (reg:SF 169))
            (use (reg/v:PSI 151 ))
            (clobber (scratch:SI))
        ]) 202 {movsf_ie} (insn_list:REG_DEP_TRUE 19 (nil))
    (expr_list:REG_DEAD (reg:SF 169)
        (expr_list:REG_UNUSED (scratch:SI)
            (nil))))

(insn 36 31 0 0 ../../srcw/gcc/libgcc2.c:1685 (use (reg/i:SC 64 fr0)) -1
(insn_list:REG_DEP_TRUE 30 (nil))
    (nil))
;; End of basic block 0, registers live:
 14 [r14] 15 [r15] 64 [fr0] 65 [fr1] 145 [ap] 151 []

after combine we have:

(note 19 18 26 0 NOTE_INSN_DELETED)

(note 26 19 27 0 NOTE_INSN_FUNCTION_END)

(note 27 26 29 0 ("../../srcw/gcc/libgcc2.c") 1685)

(insn 29 27 30 0 ../../srcw/gcc/libgcc2.c:1685 (clobber (reg/i:SC 64 fr0)) -1 (nil)
    (expr_list:REG_UNUSED (reg/i:SC 64 fr0)
        (nil)))

(insn 30 29 31 0 ../../srcw/gcc/libgcc2.c:1685 (parallel [
            (set (reg:SF 64 fr0 [ <result> ])
                (reg:SF 166))
            (use (reg/v:PSI 151 ))
            (clobber (scratch:SI))
        ]) 202 {movsf_ie} (insn_list:REG_DEP_TRUE 16 (nil))
    (expr_list:REG_DEAD (reg:SF 166)
        (expr_list:REG_UNUSED (scratch:SI)
            (nil))))

(insn 31 30 36 0 ../../srcw/gcc/libgcc2.c:1685 (parallel [
            (set (reg:SF 65 fr1 [orig:64+4 ] [64])
                (plus:SF (mult:SF (reg/v:SF 160 [ a ])
                        (reg/v:SF 163 [ d ]))
                    (reg:SF 168)))
            (use (reg/v:PSI 151 ))
        ]) 299 {*macsf3} (insn_list:REG_DEP_TRUE 18 (nil))
    (expr_list:REG_DEAD (reg:SF 168)
        (expr_list:REG_DEAD (reg/v:SF 160 [ a ])
            (expr_list:REG_DEAD (reg/v:SF 163 [ d ])
                (nil)))))

(insn 36 31 0 0 ../../srcw/gcc/libgcc2.c:1685 (use (reg/i:SC 64 fr0)) -1
(insn_list:REG_DEP_TRUE 30 (nil))
    (nil))
;; End of basic block 0, registers live:
 14 [r14] 15 [r15] 64 [fr0] 65 [fr1] 145 [ap] 151 []

fr0 is the only register in FR0_REGS.  After combine, insn 31 needs FR0_REGS.
We are not supposed to complicate return value copies if they involve
CLASS_LIKELY_SPILLED registers.
Comment 1 Andrew Pinski 2005-07-02 17:26:19 UTC
Confirmed.
Comment 2 GCC Commits 2005-07-07 14:14:55 UTC
Subject: Bug 22258

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	sh-elf-4_1-branch
Changes by:	amylaar@gcc.gnu.org	2005-07-07 14:14:48

Modified files:
	gcc            : combine.c 

Log message:
	PR rtl-optimization/22258
	http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00053.html
	* combine.c (likely_spilled_retval_1, likely_spilled_retval_p):
	New functions.
	(try_combine): Use likely_spilled_retval_p.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/combine.c.diff?cvsroot=gcc&only_with_tag=sh-elf-4_1-branch&r1=1.484.2.1&r2=1.484.2.2

Comment 3 Jorn Wolfgang Rennecke 2005-07-12 13:45:57 UTC
Having this bug unfixed makes it impossible to do sh-elf regression tests on
mainline.
Comment 4 GCC Commits 2005-07-22 11:56:03 UTC
Subject: Bug 22258

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	amylaar@gcc.gnu.org	2005-07-22 11:55:43

Modified files:
	gcc            : ChangeLog combine.c 

Log message:
	PR rtl-optimization/22258
	* combine.c (likely_spilled_retval_1, likely_spilled_retval_p):
	New functions.
	(try_combine): Use likely_spilled_retval_p.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9515&r2=2.9516
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/combine.c.diff?cvsroot=gcc&r1=1.498&r2=1.499

Comment 5 Andrew Pinski 2005-07-22 17:22:23 UTC
Fixed.