public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/41646] New: [4.3/4.4/4.5 Regression] Reload ICE due to combiner extending life time of a hard register
@ 2009-10-09 14:40 jakub at gcc dot gnu dot org
2009-10-09 14:42 ` [Bug rtl-optimization/41646] " jakub at gcc dot gnu dot org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-10-09 14:40 UTC (permalink / raw)
To: gcc-bugs
struct A { unsigned long a; };
struct B { unsigned short b, c, d; };
struct B bar (unsigned long);
char *
foo (char *a, struct A *x)
{
struct B b = bar (x->a);
unsigned char c;
unsigned short d;
a[3] = ((unsigned char) (b.b % 10) + 48);
d = b.b / 10;
a[2] = ((unsigned char) (d % 10) + 48);
d = d / 10;
a[1] = ((unsigned char) (d % 10) + 48);
a[0] = ((unsigned char) ((d / 10) % 10) + 48);
a[4] = 46;
c = (unsigned char) b.c;
a[6] = (c % 10 + 48);
a[5] = ((c / 10) % 10 + 48);
a[7] = 46;
c = b.d;
a[9] = (c % 10 + 48);
a[8] = ((c / 10) % 10 + 48);
return a + 10;
}
ICEs with -O2 on x86_64-linux:
/tmp/tt.c: In function 'foo':
/tmp/tt.c:25:1: error: unable to find a register to spill in class 'AREG'
/tmp/tt.c:25:1: error: this is the insn:
(insn 82 81 83 2 /tmp/tt.c:18 (parallel [
(set (reg:HI 1 dx [170])
(mult:HI (zero_extend:HI (reg/v:QI 4 si [orig:82 c ] [82]))
(zero_extend:HI (reg:QI 2 cx [169]))))
(clobber (reg:CC 17 flags))
]) 337 {*umulqihi3_1} (expr_list:REG_UNUSED (reg:CC 17 flags)
(expr_list:REG_EQUAL (mult:HI (zero_extend:HI (reg/v:QI 4 si [orig:82 c
] [82]))
(const_int 205 [0xcd]))
(nil))))
/tmp/tt.c:25:1: internal compiler error: in spill_failure, at reload1.c:2151
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Worked in 3.4/4.0, ICEs from 4.1 onwards up to current trunk.
The problem seems to be in the combiner, it extremely lengthens the lifetime of
hard register (%rax):
in *.dce:
...
(insn 13 12 14 2 /tmp/tt.c:7 (parallel [
(set (reg:DI 113)
(lshiftrt:DI (reg:DI 0 ax)
(const_int 32 [0x20])))
(clobber (reg:CC 17 flags))
]) 549 {*lshrdi3_1_rex64} (expr_list:REG_DEAD (reg:DI 0 ax)
(expr_list:REG_UNUSED (reg:CC 17 flags)
(nil))))
(insn 14 13 16 2 /tmp/tt.c:7 (set (reg:HI 114)
(subreg:HI (reg:DI 113) 0)) 53 {*movhi_1} (expr_list:REG_DEAD (reg:DI
113)
(nil)))
... 49 insns ...
(insn 82 81 83 2 /tmp/tt.c:18 (parallel [
(set (reg:HI 168)
(mult:HI (zero_extend:HI (reg/v:QI 82 [ c ]))
(zero_extend:HI (reg:QI 169))))
(clobber (reg:CC 17 flags))
]) 337 {*umulqihi3_1} (expr_list:REG_UNUSED (reg:CC 17 flags)
(expr_list:REG_EQUAL (mult:HI (zero_extend:HI (reg/v:QI 82 [ c ]))
(const_int 205 [0xcd]))
(nil))))
... 18 insns ...
(insn 108 107 110 2 /tmp/tt.c:21 (set (reg/v:QI 93 [ c ])
(subreg:QI (reg:HI 114) 0)) 62 {*movqi_1} (expr_list:REG_DEAD (reg:HI
114)
(nil)))
...
in *.combine:
...
(note 13 12 14 2 NOTE_INSN_DELETED)
(note 14 13 16 2 NOTE_INSN_DELETED)
... many insns ...
(insn 82 81 83 2 /tmp/tt.c:18 (parallel [
(set (reg:HI 168)
(mult:HI (zero_extend:HI (reg/v:QI 82 [ c ]))
(zero_extend:HI (reg:QI 169))))
(clobber (reg:CC 17 flags))
]) 337 {*umulqihi3_1} (expr_list:REG_UNUSED (reg:CC 17 flags)
(expr_list:REG_EQUAL (mult:HI (zero_extend:HI (reg/v:QI 82 [ c ]))
(const_int 205 [0xcd]))
(nil))))
... many insns ...
(insn 108 107 110 2 /tmp/tt.c:21 (parallel [
(set (subreg:DI (reg/v:QI 93 [ c ]) 0)
(lshiftrt:DI (reg:DI 0 ax)
(const_int 32 [0x20])))
(clobber (reg:CC 17 flags))
]) 549 {*lshrdi3_1_rex64} (expr_list:REG_UNUSED (reg:CC 17 flags)
(expr_list:REG_DEAD (reg:DI 0 ax)
(nil))))
...
--
Summary: [4.3/4.4/4.5 Regression] Reload ICE due to combiner
extending life time of a hard register
Product: gcc
Version: 4.4.1
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jakub at gcc dot gnu dot org
GCC target triplet: x86_64-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41646
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/41646] [4.3/4.4/4.5 Regression] Reload ICE due to combiner extending life time of a hard register
2009-10-09 14:40 [Bug rtl-optimization/41646] New: [4.3/4.4/4.5 Regression] Reload ICE due to combiner extending life time of a hard register jakub at gcc dot gnu dot org
@ 2009-10-09 14:42 ` jakub at gcc dot gnu dot org
2009-10-09 15:35 ` jakub at gcc dot gnu dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-10-09 14:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from jakub at gcc dot gnu dot org 2009-10-09 14:42 -------
Or perhaps the bug is that we should force the return value into a register to
avoid having hard regs in the arithmetic instructions so early.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41646
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/41646] [4.3/4.4/4.5 Regression] Reload ICE due to combiner extending life time of a hard register
2009-10-09 14:40 [Bug rtl-optimization/41646] New: [4.3/4.4/4.5 Regression] Reload ICE due to combiner extending life time of a hard register jakub at gcc dot gnu dot org
2009-10-09 14:42 ` [Bug rtl-optimization/41646] " jakub at gcc dot gnu dot org
@ 2009-10-09 15:35 ` jakub at gcc dot gnu dot org
2009-10-09 19:02 ` jakub at gcc dot gnu dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-10-09 15:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from jakub at gcc dot gnu dot org 2009-10-09 15:35 -------
Created an attachment (id=18767)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18767&action=view)
gcc45-pr41646.patch
Patch I'm going to bootstrap/regtest.
cant_combine_insn_p already takes care of not combining in hard registers with
likely spilled classes in the (set (reg) (hardreg)) cases, so it is just when
expand doesn't honor this.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jakub at gcc dot gnu dot org
|dot org |
Status|UNCONFIRMED |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41646
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/41646] [4.3/4.4/4.5 Regression] Reload ICE due to combiner extending life time of a hard register
2009-10-09 14:40 [Bug rtl-optimization/41646] New: [4.3/4.4/4.5 Regression] Reload ICE due to combiner extending life time of a hard register jakub at gcc dot gnu dot org
2009-10-09 14:42 ` [Bug rtl-optimization/41646] " jakub at gcc dot gnu dot org
2009-10-09 15:35 ` jakub at gcc dot gnu dot org
@ 2009-10-09 19:02 ` jakub at gcc dot gnu dot org
2009-10-12 8:48 ` jakub at gcc dot gnu dot org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-10-09 19:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jakub at gcc dot gnu dot org 2009-10-09 19:02 -------
Subject: Bug 41646
Author: jakub
Date: Fri Oct 9 19:01:53 2009
New Revision: 152597
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152597
Log:
PR rtl-optimization/41646
* calls.c (expand_call): For BLKmode types returned in registers
avoid likely spilled hard regs in copy_blkmode_from_reg generated
insns.
* gcc.c-torture/compile/pr41646.c: New test.
Added:
trunk/gcc/testsuite/gcc.c-torture/compile/pr41646.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/calls.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41646
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/41646] [4.3/4.4/4.5 Regression] Reload ICE due to combiner extending life time of a hard register
2009-10-09 14:40 [Bug rtl-optimization/41646] New: [4.3/4.4/4.5 Regression] Reload ICE due to combiner extending life time of a hard register jakub at gcc dot gnu dot org
` (2 preceding siblings ...)
2009-10-09 19:02 ` jakub at gcc dot gnu dot org
@ 2009-10-12 8:48 ` jakub at gcc dot gnu dot org
2009-10-12 13:38 ` jakub at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-10-12 8:48 UTC (permalink / raw)
To: gcc-bugs
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.3.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41646
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/41646] [4.3/4.4/4.5 Regression] Reload ICE due to combiner extending life time of a hard register
2009-10-09 14:40 [Bug rtl-optimization/41646] New: [4.3/4.4/4.5 Regression] Reload ICE due to combiner extending life time of a hard register jakub at gcc dot gnu dot org
` (3 preceding siblings ...)
2009-10-12 8:48 ` jakub at gcc dot gnu dot org
@ 2009-10-12 13:38 ` jakub at gcc dot gnu dot org
2009-10-12 13:54 ` [Bug rtl-optimization/41646] [4.3 " jakub at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-10-12 13:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jakub at gcc dot gnu dot org 2009-10-12 13:38 -------
Subject: Bug 41646
Author: jakub
Date: Mon Oct 12 13:38:29 2009
New Revision: 152666
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152666
Log:
PR rtl-optimization/41646
* calls.c (expand_call): For BLKmode types returned in registers
avoid likely spilled hard regs in copy_blkmode_from_reg generated
insns.
* gcc.c-torture/compile/pr41646.c: New test.
Added:
branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr41646.c
Modified:
branches/gcc-4_4-branch/gcc/ChangeLog
branches/gcc-4_4-branch/gcc/calls.c
branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41646
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/41646] [4.3 Regression] Reload ICE due to combiner extending life time of a hard register
2009-10-09 14:40 [Bug rtl-optimization/41646] New: [4.3/4.4/4.5 Regression] Reload ICE due to combiner extending life time of a hard register jakub at gcc dot gnu dot org
` (4 preceding siblings ...)
2009-10-12 13:38 ` jakub at gcc dot gnu dot org
@ 2009-10-12 13:54 ` jakub at gcc dot gnu dot org
2010-01-02 16:29 ` rguenth at gcc dot gnu dot org
2010-05-22 18:43 ` rguenth at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-10-12 13:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from jakub at gcc dot gnu dot org 2009-10-12 13:54 -------
Fixed in 4.4/4.5 for now.
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|jakub at gcc dot gnu dot org|unassigned at gcc dot gnu
| |dot org
Status|ASSIGNED |UNCONFIRMED
Summary|[4.3/4.4/4.5 Regression] |[4.3 Regression] Reload ICE
|Reload ICE due to combiner |due to combiner extending
|extending life time of a |life time of a hard register
|hard register |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41646
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/41646] [4.3 Regression] Reload ICE due to combiner extending life time of a hard register
2009-10-09 14:40 [Bug rtl-optimization/41646] New: [4.3/4.4/4.5 Regression] Reload ICE due to combiner extending life time of a hard register jakub at gcc dot gnu dot org
` (5 preceding siblings ...)
2009-10-12 13:54 ` [Bug rtl-optimization/41646] [4.3 " jakub at gcc dot gnu dot org
@ 2010-01-02 16:29 ` rguenth at gcc dot gnu dot org
2010-05-22 18:43 ` rguenth at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-02 16:29 UTC (permalink / raw)
To: gcc-bugs
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Known to fail| |4.3.4 4.4.1
Known to work| |4.4.2 4.5.0
Priority|P3 |P2
Last reconfirmed|0000-00-00 00:00:00 |2010-01-02 16:29:44
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41646
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/41646] [4.3 Regression] Reload ICE due to combiner extending life time of a hard register
2009-10-09 14:40 [Bug rtl-optimization/41646] New: [4.3/4.4/4.5 Regression] Reload ICE due to combiner extending life time of a hard register jakub at gcc dot gnu dot org
` (6 preceding siblings ...)
2010-01-02 16:29 ` rguenth at gcc dot gnu dot org
@ 2010-05-22 18:43 ` rguenth at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-05-22 18:43 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from rguenth at gcc dot gnu dot org 2010-05-22 18:13 -------
GCC 4.3.5 is being released, adjusting target milestone.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.3.5 |4.3.6
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41646
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-05-22 18:33 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-09 14:40 [Bug rtl-optimization/41646] New: [4.3/4.4/4.5 Regression] Reload ICE due to combiner extending life time of a hard register jakub at gcc dot gnu dot org
2009-10-09 14:42 ` [Bug rtl-optimization/41646] " jakub at gcc dot gnu dot org
2009-10-09 15:35 ` jakub at gcc dot gnu dot org
2009-10-09 19:02 ` jakub at gcc dot gnu dot org
2009-10-12 8:48 ` jakub at gcc dot gnu dot org
2009-10-12 13:38 ` jakub at gcc dot gnu dot org
2009-10-12 13:54 ` [Bug rtl-optimization/41646] [4.3 " jakub at gcc dot gnu dot org
2010-01-02 16:29 ` rguenth at gcc dot gnu dot org
2010-05-22 18:43 ` rguenth at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).