public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
[not found] <bug-25130-4@http.gcc.gnu.org/bugzilla/>
@ 2011-06-13 12:48 ` jakub at gcc dot gnu.org
2011-12-02 13:04 ` steven at gcc dot gnu.org
1 sibling, 0 replies; 23+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-06-13 12:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
CC| |jakub at gcc dot gnu.org
Resolution|FIXED |
Known to fail| |
--- Comment #23 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-06-13 12:47:14 UTC ---
(In reply to comment #21)
> The patch that was committed (especially the cse.c exp_equiv_p part) seems like
> a big hammer, and it does cause missed optimization opportunities.
>
> Reverting it on gcc-4.1-branch, and instead applying the patch for PR41033,
> also gives a compiler that correctly compiles this testcase.
>
> PR41033 adds a test for flag_strict_aliasing to nonverlapping_component_refs_p,
> which corrects the return value for canon_true_dependence mentioned in comment
> #9.
>
> Steven, are you certain that this patch is necessary in light of this?
As PR49390 shows, yes.
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
[not found] <bug-25130-4@http.gcc.gnu.org/bugzilla/>
2011-06-13 12:48 ` [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE jakub at gcc dot gnu.org
@ 2011-12-02 13:04 ` steven at gcc dot gnu.org
1 sibling, 0 replies; 23+ messages in thread
From: steven at gcc dot gnu.org @ 2011-12-02 13:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
Steven Bosscher <steven at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution| |FIXED
--- Comment #24 from Steven Bosscher <steven at gcc dot gnu.org> 2011-12-02 13:03:13 UTC ---
Fixed by Jakub's patch for PR49390.
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
` (19 preceding siblings ...)
2010-06-28 17:50 ` bernds at gcc dot gnu dot org
@ 2010-06-29 22:41 ` bernds at gcc dot gnu dot org
20 siblings, 0 replies; 23+ messages in thread
From: bernds at gcc dot gnu dot org @ 2010-06-29 22:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #22 from bernds at gcc dot gnu dot org 2010-06-29 22:41 -------
Closing this again. The partial revert was approved and committed as r161534.
--
bernds at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
` (18 preceding siblings ...)
2006-01-03 22:39 ` steven at gcc dot gnu dot org
@ 2010-06-28 17:50 ` bernds at gcc dot gnu dot org
2010-06-29 22:41 ` bernds at gcc dot gnu dot org
20 siblings, 0 replies; 23+ messages in thread
From: bernds at gcc dot gnu dot org @ 2010-06-28 17:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #21 from bernds at gcc dot gnu dot org 2010-06-28 17:50 -------
The patch that was committed (especially the cse.c exp_equiv_p part) seems like
a big hammer, and it does cause missed optimization opportunities.
Reverting it on gcc-4.1-branch, and instead applying the patch for PR41033,
also gives a compiler that correctly compiles this testcase.
PR41033 adds a test for flag_strict_aliasing to nonverlapping_component_refs_p,
which corrects the return value for canon_true_dependence mentioned in comment
#9.
Steven, are you certain that this patch is necessary in light of this?
--
bernds at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
` (17 preceding siblings ...)
2006-01-03 22:37 ` steven at gcc dot gnu dot org
@ 2006-01-03 22:39 ` steven at gcc dot gnu dot org
2010-06-28 17:50 ` bernds at gcc dot gnu dot org
2010-06-29 22:41 ` bernds at gcc dot gnu dot org
20 siblings, 0 replies; 23+ messages in thread
From: steven at gcc dot gnu dot org @ 2006-01-03 22:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #20 from steven at gcc dot gnu dot org 2006-01-03 22:39 -------
One part of the problem is fixed, and the test cases now pass.
There is still the RTL alias analysis bug mentioned in the thread on gcc@
starting here: http://gcc.gnu.org/ml/gcc/2006-01/msg00008.html. But that is an
issue that deserves its own PR.
--
steven at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
` (16 preceding siblings ...)
2006-01-03 6:20 ` steven at gcc dot gnu dot org
@ 2006-01-03 22:37 ` steven at gcc dot gnu dot org
2006-01-03 22:39 ` steven at gcc dot gnu dot org
` (2 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: steven at gcc dot gnu dot org @ 2006-01-03 22:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #19 from steven at gcc dot gnu dot org 2006-01-03 22:37 -------
Subject: Bug 25130
Author: steven
Date: Tue Jan 3 22:37:46 2006
New Revision: 109292
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109292
Log:
2006-01-03 Steven Bosscher <stevenb.gcc@gmail.com>
* fold-const.c (operand_equal_p): Accept a NULL operand 0 for
COMPONENT_REFs.
* emit-rtl.c (mem_attrs_htab_eq): Use iterative_hash_expr for
hashing trees instead of a pointer hash.
(mem_attrs_htab_eq): Do a deep compare instead of a pointer
compare for MEM_EXPR.
PR rtl-optimization/25130
* cse.c (exp_equiv_p): Compare MEM_ATTRS instead of
* MEM_ALIAS_SET
when comparing MEMs for GCSE
Modified:
branches/gcc-4_1-branch/gcc/ChangeLog
branches/gcc-4_1-branch/gcc/cse.c
branches/gcc-4_1-branch/gcc/emit-rtl.c
branches/gcc-4_1-branch/gcc/fold-const.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
` (15 preceding siblings ...)
2006-01-01 17:37 ` steven at gcc dot gnu dot org
@ 2006-01-03 6:20 ` steven at gcc dot gnu dot org
2006-01-03 22:37 ` steven at gcc dot gnu dot org
` (3 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: steven at gcc dot gnu dot org @ 2006-01-03 6:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #18 from steven at gcc dot gnu dot org 2006-01-03 06:20 -------
Subject: Bug 25130
Author: steven
Date: Tue Jan 3 06:20:21 2006
New Revision: 109264
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109264
Log:
* fold-const.c (operand_equal_p): Accept a NULL operand 0 for
COMPONENT_REFs.
* emit-rtl.c (mem_attrs_htab_eq): Use iterative_hash_expr for
hashing trees instead of a pointer hash.
(mem_attrs_htab_eq): Do a deep compare instead of a pointer
compare for MEM_EXPR.
PR rtl-optimization/25130
* cse.c (exp_equiv_p): Compare MEM_ATTRS instead of MEM_ALIAS_SET
when comparing MEMs for GCSE
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cse.c
trunk/gcc/emit-rtl.c
trunk/gcc/fold-const.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
` (14 preceding siblings ...)
2005-12-27 0:58 ` steven at gcc dot gnu dot org
@ 2006-01-01 17:37 ` steven at gcc dot gnu dot org
2006-01-03 6:20 ` steven at gcc dot gnu dot org
` (4 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: steven at gcc dot gnu dot org @ 2006-01-01 17:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #17 from steven at gcc dot gnu dot org 2006-01-01 17:37 -------
I posted a patch that addresses the gcse.c part of the problem.
--
steven at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
URL| |http://gcc.gnu.org/ml/gcc-
| |patches/2006-
| |01/msg00007.html
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
` (13 preceding siblings ...)
2005-12-21 15:45 ` steven at gcc dot gnu dot org
@ 2005-12-27 0:58 ` steven at gcc dot gnu dot org
2006-01-01 17:37 ` steven at gcc dot gnu dot org
` (5 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-12-27 0:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #16 from steven at gcc dot gnu dot org 2005-12-27 00:58 -------
Created an attachment (id=10557)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10557&action=view)
Make hash_rtx and exp_equiv_p take MEM_ATTRS into accoutn
The test cases don't fail with GCC 4.2 anymore, but with GCC 4.1 they both
still fail. I think the right thing to do is to make the expressions not look
the same to the dataflow equations -- after all they _are_ not the same.
But with this patch I'm unsure what will happen with e.g. loads from different
fields of a union for which the MEM address looks the same. The MEM_ATTRS will
be different, so with my patch we won't see them as equivalent loads, I think.
But I haven't actually tested that. I haven't even tested the patch yet
really, but it does make the wrong-code problem go away for me.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
` (12 preceding siblings ...)
2005-12-21 15:32 ` steven at gcc dot gnu dot org
@ 2005-12-21 15:45 ` steven at gcc dot gnu dot org
2005-12-27 0:58 ` steven at gcc dot gnu dot org
` (6 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-12-21 15:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #15 from steven at gcc dot gnu dot org 2005-12-21 15:45 -------
That's what you get for working on different GCSEs at the same time.
Those commits were for Bug 25196 :-(
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
` (11 preceding siblings ...)
2005-12-21 15:28 ` steven at gcc dot gnu dot org
@ 2005-12-21 15:32 ` steven at gcc dot gnu dot org
2005-12-21 15:45 ` steven at gcc dot gnu dot org
` (7 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-12-21 15:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #14 from steven at gcc dot gnu dot org 2005-12-21 15:32 -------
Subject: Bug 25130
Author: steven
Date: Wed Dec 21 15:32:09 2005
New Revision: 108907
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108907
Log:
patch for PR rtl-optimization/25130, gcc 4.1 edition.
gcc/
* postreload-gcse.c (record_last_set_info): Notice stack pointer
changes in push insns without REG_INC notes.
testsuite/
* gcc.dg/pr25130.c: New test.
Added:
branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/pr25130.c
Modified:
branches/gcc-4_1-branch/gcc/ChangeLog
branches/gcc-4_1-branch/gcc/postreload-gcse.c
branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
` (10 preceding siblings ...)
2005-12-19 18:33 ` mmitchel at gcc dot gnu dot org
@ 2005-12-21 15:28 ` steven at gcc dot gnu dot org
2005-12-21 15:32 ` steven at gcc dot gnu dot org
` (8 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-12-21 15:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from steven at gcc dot gnu dot org 2005-12-21 15:28 -------
Subject: Bug 25130
Author: steven
Date: Wed Dec 21 15:28:16 2005
New Revision: 108906
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108906
Log:
patch for PR rtl-optimization/25130
gcc/
* postreload-gcse.c (record_last_set_info): Notice stack pointer
changes in push insns without REG_INC notes.
testsuite/
* gcc.dg/pr25130.c: New test.
Added:
trunk/gcc/testsuite/gcc.dg/pr25130.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/postreload-gcse.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
` (9 preceding siblings ...)
2005-12-18 1:38 ` steven at gcc dot gnu dot org
@ 2005-12-19 18:33 ` mmitchel at gcc dot gnu dot org
2005-12-21 15:28 ` steven at gcc dot gnu dot org
` (9 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-12-19 18:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from mmitchel at gcc dot gnu dot org 2005-12-19 18:32 -------
Serious wrong code problem: P1.
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
` (8 preceding siblings ...)
2005-12-18 0:49 ` steven at gcc dot gnu dot org
@ 2005-12-18 1:38 ` steven at gcc dot gnu dot org
2005-12-19 18:33 ` mmitchel at gcc dot gnu dot org
` (10 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-12-18 1:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from steven at gcc dot gnu dot org 2005-12-18 01:38 -------
Punt for now.
http://gcc.gnu.org/ml/gcc/2005-12/msg00504.html
--
steven at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |steven at gcc dot gnu dot
| |org
AssignedTo|steven at gcc dot gnu dot |unassigned at gcc dot gnu
|org |dot org
Status|ASSIGNED |NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
` (7 preceding siblings ...)
2005-12-17 18:24 ` steven at gcc dot gnu dot org
@ 2005-12-18 0:49 ` steven at gcc dot gnu dot org
2005-12-18 1:38 ` steven at gcc dot gnu dot org
` (11 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-12-18 0:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from steven at gcc dot gnu dot org 2005-12-18 00:49 -------
At -O1 (i.e. for my test case) CSE1 turns this...
(insn 24 22 25 0 (parallel [
(set (reg/f:SI 67)
(plus:SI (reg/f:SI 20 frame)
(const_int -16 [0xfffffff0])))
(clobber (reg:CC 17 flags))
]) 148 {*addsi_1} (nil)
(nil))
(insn 25 24 27 0 (parallel [
(set (reg/f:SI 61 [ this.1 ])
(plus:SI (reg/f:SI 67)
(const_int 4 [0x4])))
(clobber (reg:CC 17 flags))
]) 148 {*addsi_1} (nil)
(nil))
(insn 27 25 28 0 (set (reg:SI 68 [ <variable>._M_impl._M_start_node ])
(mem/s/j:SI (plus:SI (reg/f:SI 61 [ this.1 ])
(const_int 4 [0x4])) [0 <variable>._M_impl._M_start_node+0 S4
A32])) 34 {*movsi_1} (nil)
(nil))
...into this...
(insn 27 22 28 0 (set (reg:SI 68 [ <variable>._M_impl._M_start_node ])
(mem/s/j:SI (plus:SI (reg/f:SI 20 frame)
(const_int -8 [0xfffffff8])) [0
<variable>._M_impl._M_start_node+0 S4 A32])) 34 {*movsi_1} (nil)
(nil))
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
` (6 preceding siblings ...)
2005-12-17 15:14 ` steven at gcc dot gnu dot org
@ 2005-12-17 18:24 ` steven at gcc dot gnu dot org
2005-12-18 0:49 ` steven at gcc dot gnu dot org
` (12 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-12-17 18:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from steven at gcc dot gnu dot org 2005-12-17 18:23 -------
Breakpoint 7, compute_transp (x=0x4021557c, indx=0, bmap=0x894e1b8, set_p=0) at
gcse.c:2500
2500 rtx list_entry = canon_modify_mem_list[bb_index];
(gdb) p debug_rtx(x)
(mem/s/j:SI (plus:SI (reg/f:SI 20 frame)
(const_int -8 [0xfffffff8])) [0 <variable>._M_impl._M_start_node+0 S4
A32])
$33 = void
(gdb) next
2502 while (list_entry)
(gdb)
2509 dest = XEXP (list_entry, 0);
(gdb)
2510 list_entry = XEXP (list_entry, 1);
(gdb)
2511 dest_addr = XEXP (list_entry, 0);
(gdb)
2513 if (canon_true_dependence (dest, GET_MODE (dest),
dest_addr,
(gdb)
2522 list_entry = XEXP (list_entry, 1);
(gdb) p debug_rtx(x)
(mem/s/j:SI (plus:SI (reg/f:SI 20 frame)
(const_int -8 [0xfffffff8])) [0 <variable>._M_impl._M_start_node+0 S4
A32])
$34 = void
(gdb) p debug_rtx(dest)
(mem/s/j/c:SI (plus:SI (reg/f:SI 20 frame)
(const_int -8 [0xfffffff8])) [0 clusters.D.1846._M_impl._M_finish_cur+0
S4 A32])
$35 = void
(gdb)
so (mem/s/j/c:SI (plus:SI (reg/f:SI 20 frame) (const_int -8 [0xfffffff8]))) and
(mem/s/j/c:SI (plus:SI (reg/f:SI 20 frame) (const_int -8 [0xfffffff8]))) don't
conflict... But frame is not changed in the function, so surely this is wrong?
(Maybe this is obvious to people with better RTL-fu than me, so don't be too
harsh on me ;-)
--
steven at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |alias
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
` (5 preceding siblings ...)
2005-12-17 15:09 ` steven at gcc dot gnu dot org
@ 2005-12-17 15:14 ` steven at gcc dot gnu dot org
2005-12-17 18:24 ` steven at gcc dot gnu dot org
` (13 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-12-17 15:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from steven at gcc dot gnu dot org 2005-12-17 15:14 -------
It looks like we're missing a memory modification. Yes, making this a load PRE
problem after all, despite it failing for me even with -fno-gcse-lm, but oh
well.
I have these expressions in the table:
Expression hash table (11 buckets, 3 entries)
Index 0 (hash value 7)
(mem/s/j:SI (plus:SI (reg/f:SI 20 frame)
(const_int -8 [0xfffffff8])) [0 <variable>._M_impl._M_start_node+0 S4
A32])
Index 1 (hash value 10)
(mem/s/j/c:SI (plus:SI (reg/f:SI 20 frame)
(const_int -16 [0xfffffff0])) [0 clusters.D.1846._M_impl._M_start_cur+0
S4 A32])
Index 2 (hash value 3)
(mem/s/j:SI (plus:SI (reg/f:SI 20 frame)
(const_int -12 [0xfffffff4])) [0 <variable>._M_impl._M_start_node+0 S4
A32])
The second and third expressions don't do much. For the first expression we
apply load PRE. But the local data flow sets look wrong. For TRANSP I have,
transp
0
000
1
111
2
000
3
111
4
000
and block 3 for me looks like this:
;; Start of basic block 3, registers live: (nil)
(code_label 57 94 58 3 8 "" [1 uses])
(note 58 57 59 3 [bb 3] NOTE_INSN_BASIC_BLOCK)
(note 59 58 60 3 ("t.C") 55)
(insn 60 59 96 3 t.C:55 (parallel [
(set (mem/s/j/c:SI (plus:SI (reg/f:SI 20 frame)
(const_int -8 [0xfffffff8])) [0
clusters.D.1846._M_impl._M_finish_cur+0 S4 A32])
(plus:SI (mem/s/j/c:SI (plus:SI (reg/f:SI 20 frame)
(const_int -8 [0xfffffff8])) [0
clusters.D.1846._M_impl._M_finish_cur+0 S4 A32])
(const_int 4 [0x4])))
(clobber (reg:CC 17 flags))
]) 148 {*addsi_1} (nil)
(nil))
(jump_insn 96 60 97 3 (set (pc)
(label_ref 61)) -1 (nil)
(nil))
;; End of basic block 3, registers live:
(nil)
Looks to me that insn 60 should cause expression 1 to not be in TRANSP for this
basic block.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
` (4 preceding siblings ...)
2005-12-17 11:31 ` steven at gcc dot gnu dot org
@ 2005-12-17 15:09 ` steven at gcc dot gnu dot org
2005-12-17 15:14 ` steven at gcc dot gnu dot org
` (14 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-12-17 15:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from steven at gcc dot gnu dot org 2005-12-17 15:09 -------
Created an attachment (id=10519)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10519&action=view)
Smaller test case
Fails for me when compiled with:
"g++ -O -fgcse t.C -fno-exceptions -fno-tree-dominator-opts"
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
` (3 preceding siblings ...)
2005-12-17 11:27 ` steven at gcc dot gnu dot org
@ 2005-12-17 11:31 ` steven at gcc dot gnu dot org
2005-12-17 15:09 ` steven at gcc dot gnu dot org
` (15 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-12-17 11:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from steven at gcc dot gnu dot org 2005-12-17 11:31 -------
Also seen on powerpc
--
steven at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
GCC host triplet|i686-pc-linux-gnu |
GCC target triplet|i686-pc-linux-gnu |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
` (2 preceding siblings ...)
2005-12-16 23:58 ` steven at gcc dot gnu dot org
@ 2005-12-17 11:27 ` steven at gcc dot gnu dot org
2005-12-17 11:31 ` steven at gcc dot gnu dot org
` (16 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-12-17 11:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from steven at gcc dot gnu dot org 2005-12-17 11:27 -------
Looking into this.
--
steven at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |steven at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2005-11-28 02:00:05 |2005-12-17 11:27:18
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
2005-11-28 2:00 ` [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE pinskia at gcc dot gnu dot org
2005-11-29 6:10 ` wilson at gcc dot gnu dot org
@ 2005-12-16 23:58 ` steven at gcc dot gnu dot org
2005-12-17 11:27 ` steven at gcc dot gnu dot org
` (17 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-12-16 23:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from steven at gcc dot gnu dot org 2005-12-16 23:58 -------
Re. comment #3, I can reproduce the bug with -fno-gcse-lm too, so this may be
unrelated to load motion. I also tried with -O -fgcse and I'm seeing the bug
then, too. Finally, I tried with CPROP1, CPROP2 and load pre commented out,
and it still fails. So it may be normal PRE breaking things.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
2005-11-28 2:00 ` [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE pinskia at gcc dot gnu dot org
@ 2005-11-29 6:10 ` wilson at gcc dot gnu dot org
2005-12-16 23:58 ` steven at gcc dot gnu dot org
` (18 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: wilson at gcc dot gnu dot org @ 2005-11-29 6:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from wilson at gcc dot gnu dot org 2005-11-29 06:10 -------
This is indeed a gcse problem. It is a problem with the load motion support.
There are some similarities to PR 24804 here. We have multiple overlapping
objects on the stack, that have mems with different MEM_EXPR fields, that are
being treated as the same object because they have the same hash code. This
results in some new RTL being emitted by gcse that has mems with incorrect
MEM_EXPR fields. This doesn't cause the failure though, and seems to be
harmless for this testcase. This is potentially a problem for other testcases
though.
The problem happens shortly before the printf call. We have before gcse
(insn 60 58 61 3 (parallel [
(set (mem/s/j/c:SI (plus:SI (reg/f:SI 20 frame)
(const_int -8 [0xfffffffffffffff8])) [0
clusters.D.1787\._M_impl._M_finish_cur+0 S4 A32])
(plus:SI (mem/s/j/c:SI (plus:SI (reg/f:SI 20 frame)
(const_int -8 [0xfffffffffffffff8])) [0
clusters.D.\1787._M_impl._M_finish_cur+0 S4 A32])
(const_int 4 [0x4])))
(clobber (reg:CC 17 flags))
]) 208 {*addsi_1} (nil)
(nil))
;; End of basic block 3, registers live:
(nil)
;; Start of basic block 4, registers live: (nil)
(code_label 61 60 62 4 4 "" [1 uses])
(note 62 61 64 4 [bb 4] NOTE_INSN_BASIC_BLOCK)
(insn 64 62 65 4 (set (reg:SI 72 [ clusters.D.1787._M_impl._M_finish_cur ])
(mem/s/j/c:SI (plus:SI (reg/f:SI 20 frame)
(const_int -8 [0xfffffffffffffff8])) [0
clusters.D.1787._M_impl\._M_finish_cur+0 S4 A32])) 40 {*movsi_1} (nil)
(nil))
and after gcse we have
(insn 60 58 124 3 (parallel [
(set (mem/s/j/c:SI (plus:SI (reg/f:SI 20 frame)
(const_int -8 [0xfffffffffffffff8])) [0
clusters.D.1787\._M_impl._M_finish_cur+0 S4 A32])
(plus:SI (mem/s/j/c:SI (plus:SI (reg/f:SI 20 frame)
(const_int -8 [0xfffffffffffffff8])) [0
clusters.D.\1787._M_impl._M_finish_cur+0 S4 A32])
(const_int 4 [0x4])))
(clobber (reg:CC 17 flags))
]) 208 {*addsi_1} (nil)
(nil))
(jump_insn 124 60 125 3 (set (pc)
(label_ref 61)) -1 (nil)
(nil))
;; End of basic block 3, registers live:
(nil)
(barrier 125 124 127)
;; Start of basic block 4, registers live: (nil)
(code_label 127 125 126 4 12 "" [1 uses])
(note 126 127 121 4 [bb 4] NOTE_INSN_BASIC_BLOCK)
(insn 121 126 61 4 (set (reg:SI 79 [ clusters.D.1787._M_impl._M_finish_cur ])
(mem/s/j:SI (plus:SI (reg/f:SI 20 frame)
(const_int -8 [0xfffffffffffffff8])) [0
<variable>._M_impl._M_s\tart_node+0 S4 A32])) 40 {*movsi_1} (nil)
(nil))
;; End of basic block 4, registers live:
(nil)
;; Start of basic block 5, registers live: (nil)
(code_label 61 121 62 5 4 "" [1 uses])
(note 62 61 65 5 [bb 5] NOTE_INSN_BASIC_BLOCK)
(insn 65 62 66 5 (set (mem:SI (plus:SI (reg/f:SI 7 sp)
(const_int 8 [0x8])) [0 S4 A32])
(reg:SI 79 [ clusters.D.1787._M_impl._M_finish_cur ])) 40 {*movsi_1}
(n\il)
(nil))
For some reason, gcse thought that insn 64 was redundant, and deleted it,
adding a new basic block with a load as compensation code. This results in reg
79 having the wrong value when we go from the increment to the printf.
I haven't pinpointed an exact cause of the problem. The gcse algorithmics are
complicated. I think the underlying failure is that we are adding mems to the
expression table, and adding their load/store insns to the ldst_table. When we
find a load/store we can't handle, we remove it from the ldst_table. However,
we never remove entries from the expression table. Since there are still mems
in the expression table, gcse still tries to optimize them. And this results
in bad code, because some load/store insns needs fixups when their mems are
optimized, and these fixups do not happen because the load/store insns are no
longer in the ldst_table. The fixups are supposed to be emitted in
update_ld_motion_stores.
--
wilson at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |wilson at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
@ 2005-11-28 2:00 ` pinskia at gcc dot gnu dot org
2005-11-29 6:10 ` wilson at gcc dot gnu dot org
` (19 subsequent siblings)
20 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-28 2:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2005-11-28 02:00 -------
Loop optimizers don't do anything to this testcase as there are no loops.
-fno-gcse fixes it so I am going to assume it is GCSE bug. Anyways confirmed.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2005-11-28 02:00:05
date| |
Summary|4.1: miscompilation in loop |[4.1/4.2 Regression]
|optimization |miscompilation in GCSE
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25130
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2011-12-02 13:04 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-25130-4@http.gcc.gnu.org/bugzilla/>
2011-06-13 12:48 ` [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE jakub at gcc dot gnu.org
2011-12-02 13:04 ` steven at gcc dot gnu.org
2005-11-28 1:24 [Bug rtl-optimization/25130] New: 4.1: miscompilation in loop optimization gcc-bugzilla at gcc dot gnu dot org
2005-11-28 2:00 ` [Bug rtl-optimization/25130] [4.1/4.2 Regression] miscompilation in GCSE pinskia at gcc dot gnu dot org
2005-11-29 6:10 ` wilson at gcc dot gnu dot org
2005-12-16 23:58 ` steven at gcc dot gnu dot org
2005-12-17 11:27 ` steven at gcc dot gnu dot org
2005-12-17 11:31 ` steven at gcc dot gnu dot org
2005-12-17 15:09 ` steven at gcc dot gnu dot org
2005-12-17 15:14 ` steven at gcc dot gnu dot org
2005-12-17 18:24 ` steven at gcc dot gnu dot org
2005-12-18 0:49 ` steven at gcc dot gnu dot org
2005-12-18 1:38 ` steven at gcc dot gnu dot org
2005-12-19 18:33 ` mmitchel at gcc dot gnu dot org
2005-12-21 15:28 ` steven at gcc dot gnu dot org
2005-12-21 15:32 ` steven at gcc dot gnu dot org
2005-12-21 15:45 ` steven at gcc dot gnu dot org
2005-12-27 0:58 ` steven at gcc dot gnu dot org
2006-01-01 17:37 ` steven at gcc dot gnu dot org
2006-01-03 6:20 ` steven at gcc dot gnu dot org
2006-01-03 22:37 ` steven at gcc dot gnu dot org
2006-01-03 22:39 ` steven at gcc dot gnu dot org
2010-06-28 17:50 ` bernds at gcc dot gnu dot org
2010-06-29 22:41 ` bernds 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).