public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/41511] New: [4.5 Regression] combine behaves differently with/without -g
@ 2009-09-30 1:55 kkojima at gcc dot gnu dot org
2009-09-30 1:59 ` [Bug rtl-optimization/41511] " kkojima at gcc dot gnu dot org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-09-30 1:55 UTC (permalink / raw)
To: gcc-bugs
This may be a generic problem, though it's found on SH.
sh4-unknown-linux-gnu fails to bootstrap for a while with:
Comparing stages 2 and 3
warning: gcc/cc1-checksum.o differs
Bootstrap comparison failure!
gcc/cfgexpand.o differs
gcc/omp-low.o differs
The stage2 cfgexpand.o is compiled with -g -O2 -gtoggle and
the stage3 one is compiled with -g -O2. I've confirmed that
even the cross compiler gives the different results with/without
-g at -O2 for cfgexpand.
--
Summary: [4.5 Regression] combine behaves differently
with/without -g
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kkojima at gcc dot gnu dot org
GCC target triplet: sh4-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41511
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/41511] [4.5 Regression] combine behaves differently with/without -g
2009-09-30 1:55 [Bug rtl-optimization/41511] New: [4.5 Regression] combine behaves differently with/without -g kkojima at gcc dot gnu dot org
@ 2009-09-30 1:59 ` kkojima at gcc dot gnu dot org
2009-09-30 2:00 ` kkojima at gcc dot gnu dot org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-09-30 1:59 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from kkojima at gcc dot gnu dot org 2009-09-30 01:58 -------
Created an attachment (id=18668)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18668&action=view)
A reduced test case
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41511
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/41511] [4.5 Regression] combine behaves differently with/without -g
2009-09-30 1:55 [Bug rtl-optimization/41511] New: [4.5 Regression] combine behaves differently with/without -g kkojima at gcc dot gnu dot org
2009-09-30 1:59 ` [Bug rtl-optimization/41511] " kkojima at gcc dot gnu dot org
@ 2009-09-30 2:00 ` kkojima at gcc dot gnu dot org
2009-09-30 9:49 ` rguenth at gcc dot gnu dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-09-30 2:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from kkojima at gcc dot gnu dot org 2009-09-30 02:00 -------
It seems that the difference occurs at combine pass. With -g,
two insns
(insn 104 102 106 12 xxx.c:127 (set (reg:SI 207 [ stmt_4->gsbase.code ])
(zero_extend:SI (reg:QI 219 [ stmt_4->gsbase.code ]))) 156
{*zero_extendqisi2_compact} (expr_list:REG_DEAD (reg:QI 219 [
stmt_4->gsbase.code ])
(expr_list:REG_EQUAL (zero_extend:SI (mem/s/j:QI (reg/v/f:SI 161 [ stmt
]) [0 stmt_4->gsbase.code+0 S1 A32]))
(nil))))
(insn 106 104 107 12 xxx.c:127 (set (reg:SI 147 t)
(eq:SI (reg:SI 207 [ stmt_4->gsbase.code ])
(const_int 6 [0x6]))) 1 {cmpeqsi_t} (expr_list:REG_DEAD (reg:SI 207
[ stmt_4->gsbase.code ])
(nil)))
are successfully combined:
Trying 104 -> 106:
Successfully matched this instruction:
(set (reg:SI 147 t)
(eq:SI (subreg:SI (reg:QI 219 [ stmt_4->gsbase.code ]) 0)
(const_int 6 [0x6])))
but without -g, the corresponding two insns
(insn 89 87 91 12 xxx.c:127 (set (reg:SI 207 [ stmt_4->gsbase.code ])
(zero_extend:SI (reg:QI 219 [ stmt_4->gsbase.code ]))) 156
{*zero_extendqisi2_compact} (expr_list:REG_DEAD (reg:QI 219 [
stmt_4->gsbase.code ])
(expr_list:REG_EQUAL (zero_extend:SI (mem/s/j:QI (reg/v/f:SI 161 [ stmt
]) [0 stmt_4->gsbase.code+0 S1 A32]))
(nil))))
(insn 91 89 92 12 xxx.c:127 (set (reg:SI 147 t)
(eq:SI (reg:SI 207 [ stmt_4->gsbase.code ])
(const_int 6 [0x6]))) 1 {cmpeqsi_t} (expr_list:REG_DEAD (reg:SI 207
[ stmt_4->gsbase.code ])
(nil)))
are filed to be combined:
Trying 89 -> 91:
Failed to match this instruction:
(set (reg:SI 147 t)
(eq:SI (reg:QI 219 [ stmt_4->gsbase.code ])
(const_int 6 [0x6])))
I've traced what is going on in try_combine for these 2 cases and
found the combine.c:get_last_value returns (clobber (const_int 0))
without -g but (mem/s/j:QI (reg/v/f:SI 161)) with -g for
(reg:QI 219 [ stmt_4->gsbase.code ]).
Without -g, get_last_value_validate replaces the original *loc
(mem/s/j:QI (reg/v/f:SI 161)) with (clobber (const_int 0)) by
/* If this is a memory reference, make sure that there were
no stores after it that might have clobbered the value. We don't
have alias info, so we assume any store invalidates it. */
else if (MEM_P (x) && !MEM_READONLY_P (x)
&& DF_INSN_LUID (insn) <= mem_last_set)
{
if (replace)
*loc = gen_rtx_CLOBBER (GET_MODE (x), const0_rtx);
return replace;
}
where insn is
(insn 21 20 22 4 xxx.c:135 (set (reg:QI 219 [ stmt_4->gsbase.code ])
(mem/s/j:QI (reg/v/f:SI 161 [ stmt ]) [0 stmt_4->gsbase.code+0 S1
A32]))
both DF_INSN_LUID (insn) and mem_last_set are 0 here.
This mem_last_set is set to 0 at
0x0869b923 in record_dead_and_set_regs_1 (dest=0xb7fb0fb4, setter=0xb7fb0fc0,
data=0xb7fb80d8) at ../../LOCAL/trunk/gcc/combine.c:11823
11823 mem_last_set = DF_INSN_LUID (record_dead_insn);
(gdb) call debug_rtx(record_dead_insn)
(insn 87 86 89 12 xxx.c:152 (set (mem/s:SI (reg/v/f:SI 166 [ rhs ]) [0
rhs_27->exp.locus+0 S4 A32])
(reg:SI 168 [ D.2312 ])) 175 {movsi_ie} (expr_list:REG_DEAD (reg:SI 168
[ D.2312 ])
(nil)))
With -g, mem_last_set is set to 1 at the same situation with insn
(insn 88 87 89 11 xxx.c:146 (set (reg:HI 201 [ rhs_27->base.code ])
(mem/s/j:HI (reg/v/f:SI 166 [ rhs ]) [0 rhs_27->base.code+0 S2 A32]))
187 {movhi_i} (nil))
because there is an insn just before insn 88 for debug:
(insn 87 86 88 11 xxx.c:146 (set (reg/f:SI 199)
(symbol_ref:SI ("tree_code_type") [flags 0x40] <var_decl 0xb7efb228
tree_code_type>)) 175 {movsi_ie} (nil))
which doesn't appear without -g.
It looks that DF_INSN_LUID can be unique only in each basic blocks
here and the above code of get_last_value_validate compares DF_INSN_LUID
of insns at different basic blocks.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41511
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/41511] [4.5 Regression] combine behaves differently with/without -g
2009-09-30 1:55 [Bug rtl-optimization/41511] New: [4.5 Regression] combine behaves differently with/without -g kkojima at gcc dot gnu dot org
2009-09-30 1:59 ` [Bug rtl-optimization/41511] " kkojima at gcc dot gnu dot org
2009-09-30 2:00 ` kkojima at gcc dot gnu dot org
@ 2009-09-30 9:49 ` rguenth at gcc dot gnu dot org
2009-09-30 20:11 ` rguenth at gcc dot gnu dot org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-09-30 9:49 UTC (permalink / raw)
To: gcc-bugs
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41511
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/41511] [4.5 Regression] combine behaves differently with/without -g
2009-09-30 1:55 [Bug rtl-optimization/41511] New: [4.5 Regression] combine behaves differently with/without -g kkojima at gcc dot gnu dot org
` (2 preceding siblings ...)
2009-09-30 9:49 ` rguenth at gcc dot gnu dot org
@ 2009-09-30 20:11 ` rguenth at gcc dot gnu dot org
2009-10-02 16:36 ` jakub at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-09-30 20:11 UTC (permalink / raw)
To: gcc-bugs
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41511
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/41511] [4.5 Regression] combine behaves differently with/without -g
2009-09-30 1:55 [Bug rtl-optimization/41511] New: [4.5 Regression] combine behaves differently with/without -g kkojima at gcc dot gnu dot org
` (3 preceding siblings ...)
2009-09-30 20:11 ` rguenth at gcc dot gnu dot org
@ 2009-10-02 16:36 ` jakub at gcc dot gnu dot org
2009-10-03 4:00 ` kkojima 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-02 16:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from jakub at gcc dot gnu dot org 2009-10-02 16:35 -------
Created an attachment (id=18693)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18693&action=view)
gcc45-pr41511.patch
Agreed. Patch I'm going to bootstrap/regtested on x86_64-linux and i686-linux
now, fixes this -fcompare-debug issue on the testcase in x86_64-linux ->
sh4-linux cross.
The zero extension is indeed unneeded in this case, perhaps
reg_num_sign_bit_copies_for_combine could try harder. The thing is that if
get_last_value before the final validation finds it is MEM and only the
validation changes it into a clobber because it is unknown what value will the
memory have, if LOAD_EXTEND_OP is SIGN_EXTEND for the mode, it doesn't really
matter what value the memory has for num_sign_bit_copies.
--
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=41511
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/41511] [4.5 Regression] combine behaves differently with/without -g
2009-09-30 1:55 [Bug rtl-optimization/41511] New: [4.5 Regression] combine behaves differently with/without -g kkojima at gcc dot gnu dot org
` (4 preceding siblings ...)
2009-10-02 16:36 ` jakub at gcc dot gnu dot org
@ 2009-10-03 4:00 ` kkojima at gcc dot gnu dot org
2009-10-05 17:48 ` ebotcazou at gcc dot gnu dot org
2009-10-05 17:53 ` ebotcazou at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-10-03 4:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from kkojima at gcc dot gnu dot org 2009-10-03 04:00 -------
With the patch, native sh4-linux stage2 compiler generates the same
codes with and without -g for cfgexpand.c/omp-low.c. I believe that
it restores the bootstrap on sh. Thanks for taking a look at this
problem.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41511
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/41511] [4.5 Regression] combine behaves differently with/without -g
2009-09-30 1:55 [Bug rtl-optimization/41511] New: [4.5 Regression] combine behaves differently with/without -g kkojima at gcc dot gnu dot org
` (5 preceding siblings ...)
2009-10-03 4:00 ` kkojima at gcc dot gnu dot org
@ 2009-10-05 17:48 ` ebotcazou at gcc dot gnu dot org
2009-10-05 17:53 ` ebotcazou at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2009-10-05 17:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from ebotcazou at gcc dot gnu dot org 2009-10-05 17:48 -------
Subject: Bug 41511
Author: ebotcazou
Date: Mon Oct 5 17:48:09 2009
New Revision: 152459
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152459
Log:
PR rtl-optimization/41511
* combine.c (record_value_for_reg): Pass explicit values as argument
to get_last_value_validate.
(get_last_value_validate): Document INSN parameter.
For non-readonly MEMs, assume they might have been modified if INSN
was in another basic block.
(get_last_value): Minor reformatting.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/combine.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41511
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug rtl-optimization/41511] [4.5 Regression] combine behaves differently with/without -g
2009-09-30 1:55 [Bug rtl-optimization/41511] New: [4.5 Regression] combine behaves differently with/without -g kkojima at gcc dot gnu dot org
` (6 preceding siblings ...)
2009-10-05 17:48 ` ebotcazou at gcc dot gnu dot org
@ 2009-10-05 17:53 ` ebotcazou at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2009-10-05 17:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from ebotcazou at gcc dot gnu dot org 2009-10-05 17:53 -------
After the longest freeze ever :-)
--
ebotcazou at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ebotcazou at gcc dot gnu dot
| |org
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41511
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-10-05 17:53 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-30 1:55 [Bug rtl-optimization/41511] New: [4.5 Regression] combine behaves differently with/without -g kkojima at gcc dot gnu dot org
2009-09-30 1:59 ` [Bug rtl-optimization/41511] " kkojima at gcc dot gnu dot org
2009-09-30 2:00 ` kkojima at gcc dot gnu dot org
2009-09-30 9:49 ` rguenth at gcc dot gnu dot org
2009-09-30 20:11 ` rguenth at gcc dot gnu dot org
2009-10-02 16:36 ` jakub at gcc dot gnu dot org
2009-10-03 4:00 ` kkojima at gcc dot gnu dot org
2009-10-05 17:48 ` ebotcazou at gcc dot gnu dot org
2009-10-05 17:53 ` ebotcazou 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).