public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/30807] New: sh postreload bug (might be generic in trunk)
@ 2007-02-15 14:33 christian dot bruel at st dot com
2007-02-15 15:37 ` [Bug middle-end/30807] " christian dot bruel at st dot com
` (9 more replies)
0 siblings, 10 replies; 15+ messages in thread
From: christian dot bruel at st dot com @ 2007-02-15 14:33 UTC (permalink / raw)
To: gcc-bugs
I can only reproduce this problem on the sh target with a gcc version 3.4.3.
However my analysis makes me believe the problem still exists on the trunk.
After greg I have the following sequence :
(insn:HI 11 10 12 0 (set (reg/v/f:SI 2 r2 [orig:160 PrivateData_p ] [160])
(const_int 128 [0x80])) 122 {movsi_i} (nil)
(nil))
(insn:HI 12 11 134 0 (set (reg/v/f:SI 2 r2 [orig:160 PrivateData_p ] [160])
(plus:SI (reg/v/f:SI 2 r2 [orig:160 PrivateData_p ] [160])
(reg:SI 3 r3 [orig:162 Device_p ] [162]))) 23 {*addsi3_compact}
(insn_list 10 (insn_list 11 (nil)))
(expr_list:REG_EQUAL (plus:SI (reg:SI 3 r3 [orig:162 Device_p ] [162])
(const_int 128 [0x80]))
(nil)))
...
(insn:HI 16 135 17 0 (set (reg:SI 1 r1 [166])
(const_int 188 [0xbc])) 122 {movsi_i} (nil)
(nil))
(insn:HI 17 16 18 0 (set (reg:SI 1 r1 [166])
(plus:SI (reg:SI 1 r1 [166])
(reg/v/f:SI 2 r2 [orig:160 PrivateData_p ] [160]))) 23
{*addsi3_compact} (insn_list 16 (nil))
(expr_list:REG_EQUAL (plus:SI (reg:SI 3 r3 [orig:162 Device_p ] [162])
(const_int 316 [0x13c]))
(nil)))
'reload_combine' decides to optimize insns 16/17. After the optimisation, there
is a 'continue' and reload_combines tries other pattern.
The problem is that with this 'continue' reg_state[regno] was is updated with
the other uses (here r2).
later on insn 11/12 are optimized away, believing that r2 is dead because not
makrked in the reg_state use list, leaving it undefined.
The problem is very difficult to isolate (didn't succeed on trunk with i686)
but by reading the postreload code the bug seems latent.
--
Summary: sh postreload bug (might be generic in trunk)
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: christian dot bruel at st dot com
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnugcc
GCC target triplet: sh-superh-elf-gcc
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30807
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/30807] sh postreload bug (might be generic in trunk)
2007-02-15 14:33 [Bug middle-end/30807] New: sh postreload bug (might be generic in trunk) christian dot bruel at st dot com
@ 2007-02-15 15:37 ` christian dot bruel at st dot com
2007-02-15 15:55 ` christian dot bruel at st dot com
` (8 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: christian dot bruel at st dot com @ 2007-02-15 15:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from christian dot bruel at st dot com 2007-02-15 15:37 -------
The bug might be clearer to explain like this
we have
16: (set reg:r1) (const_int 188)
17: (set reg:r1) (plus (reg:r1 reg:r2)
18: (set reg:r1) (mem (plus (reg:r1) (const_int 4))
is transformed into
16: (set reg:r0) (const_int 192)
18: (set reg:r1) (mem (plus (reg:r0) (reg:r2))
since insn 18 is not reg_state[2].reg_use[i].insn, r2 might be seen as dead by
another similar combine transformation on previous insns
--
christian dot bruel at st dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |christian dot bruel at st
| |dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30807
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/30807] sh postreload bug (might be generic in trunk)
2007-02-15 14:33 [Bug middle-end/30807] New: sh postreload bug (might be generic in trunk) christian dot bruel at st dot com
2007-02-15 15:37 ` [Bug middle-end/30807] " christian dot bruel at st dot com
@ 2007-02-15 15:55 ` christian dot bruel at st dot com
2007-02-16 7:04 ` christian dot bruel at st dot com
` (7 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: christian dot bruel at st dot com @ 2007-02-15 15:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from christian dot bruel at st dot com 2007-02-15 15:55 -------
Created an attachment (id=13052)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13052&action=view)
Proposed fix for postreload combine
the following patch fixes the problem in the sh 3.4.3 compiler.
Since I didn't see a similar fix in the trunk, I suspect it is also needed
(even if I was not able an isns similar sequence to reproduce the problem).
-c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30807
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/30807] sh postreload bug (might be generic in trunk)
2007-02-15 14:33 [Bug middle-end/30807] New: sh postreload bug (might be generic in trunk) christian dot bruel at st dot com
2007-02-15 15:37 ` [Bug middle-end/30807] " christian dot bruel at st dot com
2007-02-15 15:55 ` christian dot bruel at st dot com
@ 2007-02-16 7:04 ` christian dot bruel at st dot com
2007-02-16 7:42 ` christian dot bruel at st dot com
` (6 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: christian dot bruel at st dot com @ 2007-02-16 7:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from christian dot bruel at st dot com 2007-02-16 07:04 -------
Created an attachment (id=13053)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13053&action=view)
Add testcase.
compile with sh-superh-elf-gcc (3.4.3) -O2 sh_postreload_bug.c -S -da
at line 28 of sh_postreload_bug.s mov.l @(r0,r2),r1 uses an unitialized r2.
in sh_postreload_bug.c.26.postreload line 47 r1 was replaced by r2 by
postreload_combine.
is it generic and not target specific ?
see patch and other attachements for proposed analysis and fix.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30807
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/30807] sh postreload bug (might be generic in trunk)
2007-02-15 14:33 [Bug middle-end/30807] New: sh postreload bug (might be generic in trunk) christian dot bruel at st dot com
` (2 preceding siblings ...)
2007-02-16 7:04 ` christian dot bruel at st dot com
@ 2007-02-16 7:42 ` christian dot bruel at st dot com
2009-05-30 22:57 ` kkojima at gcc dot gnu dot org
` (5 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: christian dot bruel at st dot com @ 2007-02-16 7:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from christian dot bruel at st dot com 2007-02-16 07:42 -------
looks like a similar analysis for a bigger case was proposed in
http://gcc.gnu.org/ml/gcc-patches/2006-01/msg01395.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30807
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/30807] sh postreload bug (might be generic in trunk)
2007-02-15 14:33 [Bug middle-end/30807] New: sh postreload bug (might be generic in trunk) christian dot bruel at st dot com
` (3 preceding siblings ...)
2007-02-16 7:42 ` christian dot bruel at st dot com
@ 2009-05-30 22:57 ` kkojima at gcc dot gnu dot org
2009-05-30 23:03 ` [Bug rtl-optimization/30807] " kkojima at gcc dot gnu dot org
` (4 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-05-30 22:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from kkojima at gcc dot gnu dot org 2009-05-30 22:56 -------
*** Bug 40301 has been marked as a duplicate of this bug. ***
--
kkojima at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sugioka at itonet dot co dot
| |jp
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30807
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/30807] postreload bug (might be generic in trunk)
2007-02-15 14:33 [Bug middle-end/30807] New: sh postreload bug (might be generic in trunk) christian dot bruel at st dot com
` (4 preceding siblings ...)
2009-05-30 22:57 ` kkojima at gcc dot gnu dot org
@ 2009-05-30 23:03 ` kkojima at gcc dot gnu dot org
2009-06-07 22:58 ` kkojima at gcc dot gnu dot org
` (3 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-05-30 23:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from kkojima at gcc dot gnu dot org 2009-05-30 23:02 -------
Reported against 4.3 with another big test case.
--
kkojima at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kkojima at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Component|middle-end |rtl-optimization
Ever Confirmed|0 |1
Known to fail| |4.3.2
Priority|P3 |P4
Last reconfirmed|0000-00-00 00:00:00 |2009-05-30 23:02:47
date| |
Summary|sh postreload bug (might be |postreload bug (might be
|generic in trunk) |generic in trunk)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30807
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/30807] postreload bug (might be generic in trunk)
2007-02-15 14:33 [Bug middle-end/30807] New: sh postreload bug (might be generic in trunk) christian dot bruel at st dot com
` (5 preceding siblings ...)
2009-05-30 23:03 ` [Bug rtl-optimization/30807] " kkojima at gcc dot gnu dot org
@ 2009-06-07 22:58 ` kkojima at gcc dot gnu dot org
2009-07-06 13:28 ` kkojima at gcc dot gnu dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-06-07 22:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from kkojima at gcc dot gnu dot org 2009-06-07 22:58 -------
Created an attachment (id=17961)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17961&action=view)
test case for 4.3
A reduced test case for 4.3 -O2 -fpic on sh4-unknown-linux-gnu.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30807
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/30807] postreload bug (might be generic in trunk)
2007-02-15 14:33 [Bug middle-end/30807] New: sh postreload bug (might be generic in trunk) christian dot bruel at st dot com
` (6 preceding siblings ...)
2009-06-07 22:58 ` kkojima at gcc dot gnu dot org
@ 2009-07-06 13:28 ` kkojima at gcc dot gnu dot org
2009-07-08 11:37 ` sezeroz at gmail dot com
2009-07-08 11:54 ` kkojima at gcc dot gnu dot org
9 siblings, 0 replies; 15+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-07-06 13:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from kkojima at gcc dot gnu dot org 2009-07-06 13:28 -------
Subject: Bug 30807
Author: kkojima
Date: Mon Jul 6 13:28:22 2009
New Revision: 149282
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149282
Log:
PR rtl-optimization/30807
* postreload.c (reload_combine): For every new use of REG_SUM,
record the use of BASE.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/postreload.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30807
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/30807] postreload bug (might be generic in trunk)
2007-02-15 14:33 [Bug middle-end/30807] New: sh postreload bug (might be generic in trunk) christian dot bruel at st dot com
` (7 preceding siblings ...)
2009-07-06 13:28 ` kkojima at gcc dot gnu dot org
@ 2009-07-08 11:37 ` sezeroz at gmail dot com
2009-07-08 11:54 ` kkojima at gcc dot gnu dot org
9 siblings, 0 replies; 15+ messages in thread
From: sezeroz at gmail dot com @ 2009-07-08 11:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from sezeroz at gmail dot com 2009-07-08 11:37 -------
Will there be a backport of this to the branches 4.3 and 4.4?
--
sezeroz at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sezeroz at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30807
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/30807] postreload bug (might be generic in trunk)
2007-02-15 14:33 [Bug middle-end/30807] New: sh postreload bug (might be generic in trunk) christian dot bruel at st dot com
` (8 preceding siblings ...)
2009-07-08 11:37 ` sezeroz at gmail dot com
@ 2009-07-08 11:54 ` kkojima at gcc dot gnu dot org
9 siblings, 0 replies; 15+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-07-08 11:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from kkojima at gcc dot gnu dot org 2009-07-08 11:54 -------
I don't think this is a regression, unfortunately.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30807
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/30807] postreload bug (might be generic in trunk)
[not found] <bug-30807-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2013-11-06 20:28 ` olegendo at gcc dot gnu.org
@ 2013-11-06 21:19 ` olegendo at gcc dot gnu.org
3 siblings, 0 replies; 15+ messages in thread
From: olegendo at gcc dot gnu.org @ 2013-11-06 21:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30807
Oleg Endo <olegendo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #14 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Test case added to 4.9. Closed.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/30807] postreload bug (might be generic in trunk)
[not found] <bug-30807-4@http.gcc.gnu.org/bugzilla/>
2013-05-22 20:41 ` olegendo at gcc dot gnu.org
2013-05-22 23:12 ` kkojima at gcc dot gnu.org
@ 2013-11-06 20:28 ` olegendo at gcc dot gnu.org
2013-11-06 21:19 ` olegendo at gcc dot gnu.org
3 siblings, 0 replies; 15+ messages in thread
From: olegendo at gcc dot gnu.org @ 2013-11-06 20:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30807
--- Comment #13 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Author: olegendo
Date: Wed Nov 6 20:26:35 2013
New Revision: 204473
URL: http://gcc.gnu.org/viewcvs?rev=204473&root=gcc&view=rev
Log:
PR target/30807
* gcc.target/sh/torture/pr30807.c: New.
Added:
trunk/gcc/testsuite/gcc.target/sh/torture/pr30807.c
Modified:
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/30807] postreload bug (might be generic in trunk)
[not found] <bug-30807-4@http.gcc.gnu.org/bugzilla/>
2013-05-22 20:41 ` olegendo at gcc dot gnu.org
@ 2013-05-22 23:12 ` kkojima at gcc dot gnu.org
2013-11-06 20:28 ` olegendo at gcc dot gnu.org
2013-11-06 21:19 ` olegendo at gcc dot gnu.org
3 siblings, 0 replies; 15+ messages in thread
From: kkojima at gcc dot gnu.org @ 2013-05-22 23:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30807
--- Comment #12 from Kazumoto Kojima <kkojima at gcc dot gnu.org> ---
(In reply to Oleg Endo from comment #11)
> Would it be OK to add this test case to gcc.target/sh/torture and close this
> PR?
Please go ahead.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug rtl-optimization/30807] postreload bug (might be generic in trunk)
[not found] <bug-30807-4@http.gcc.gnu.org/bugzilla/>
@ 2013-05-22 20:41 ` olegendo at gcc dot gnu.org
2013-05-22 23:12 ` kkojima at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 15+ messages in thread
From: olegendo at gcc dot gnu.org @ 2013-05-22 20:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30807
Oleg Endo <olegendo at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |olegendo at gcc dot gnu.org
--- Comment #11 from Oleg Endo <olegendo at gcc dot gnu.org> ---
(In reply to Kazumoto Kojima from comment #7)
> Created attachment 17961 [details]
> test case for 4.3
>
> A reduced test case for 4.3 -O2 -fpic on sh4-unknown-linux-gnu.
Would it be OK to add this test case to gcc.target/sh/torture and close this
PR?
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2013-11-06 21:19 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-15 14:33 [Bug middle-end/30807] New: sh postreload bug (might be generic in trunk) christian dot bruel at st dot com
2007-02-15 15:37 ` [Bug middle-end/30807] " christian dot bruel at st dot com
2007-02-15 15:55 ` christian dot bruel at st dot com
2007-02-16 7:04 ` christian dot bruel at st dot com
2007-02-16 7:42 ` christian dot bruel at st dot com
2009-05-30 22:57 ` kkojima at gcc dot gnu dot org
2009-05-30 23:03 ` [Bug rtl-optimization/30807] " kkojima at gcc dot gnu dot org
2009-06-07 22:58 ` kkojima at gcc dot gnu dot org
2009-07-06 13:28 ` kkojima at gcc dot gnu dot org
2009-07-08 11:37 ` sezeroz at gmail dot com
2009-07-08 11:54 ` kkojima at gcc dot gnu dot org
[not found] <bug-30807-4@http.gcc.gnu.org/bugzilla/>
2013-05-22 20:41 ` olegendo at gcc dot gnu.org
2013-05-22 23:12 ` kkojima at gcc dot gnu.org
2013-11-06 20:28 ` olegendo at gcc dot gnu.org
2013-11-06 21:19 ` olegendo at gcc dot gnu.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).