public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/45137]  New: -g changes the generated code for gcc/sched-vis.c on SH
@ 2010-07-30  0:47 kkojima at gcc dot gnu dot org
  2010-07-30  0:49 ` [Bug rtl-optimization/45137] " 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 @ 2010-07-30  0:47 UTC (permalink / raw)
  To: gcc-bugs

SH doesn't bootstrap on trunk for a while with

Comparing stages 2 and 3
warning: gcc/cc1-checksum.o differs
Bootstrap comparison failure!
gcc/sched-vis.o differs

It turned out that -g changes the result of postreload
optimization for sched-vis.c.


-- 
           Summary: -g changes the generated code for gcc/sched-vis.c on SH
           Product: gcc
           Version: 4.6.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=45137


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/45137] -g changes the generated code for gcc/sched-vis.c on SH
  2010-07-30  0:47 [Bug rtl-optimization/45137] New: -g changes the generated code for gcc/sched-vis.c on SH kkojima at gcc dot gnu dot org
@ 2010-07-30  0:49 ` kkojima at gcc dot gnu dot org
  2010-07-30  0:50 ` [Bug rtl-optimization/45137] [4.6 Regression] " 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 @ 2010-07-30  0:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from kkojima at gcc dot gnu dot org  2010-07-30 00:49 -------
Created an attachment (id=21357)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21357&action=view)
A reduced test case


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45137


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/45137] [4.6 Regression] -g changes the generated code for gcc/sched-vis.c on SH
  2010-07-30  0:47 [Bug rtl-optimization/45137] New: -g changes the generated code for gcc/sched-vis.c on SH kkojima at gcc dot gnu dot org
  2010-07-30  0:49 ` [Bug rtl-optimization/45137] " kkojima at gcc dot gnu dot org
@ 2010-07-30  0:50 ` kkojima at gcc dot gnu dot org
  2010-07-30  9:42 ` 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 @ 2010-07-30  0:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from kkojima at gcc dot gnu dot org  2010-07-30 00:50 -------
With -g, .ira for the above test case has the insns:

(insn 143 141 229 14 (set (reg/f:SI 1 r1 [238])
        (const_int 2046 [0x7fe])) yyy.c:25 176 {movsi_ie}
     (expr_list:REG_EQUAL (const_int 2046 [0x7fe])
        (nil)))

(debug_insn 229 143 144 14 (var_location:SI D#2 (reg/v/f:SI 8 r8 [orig:210 buf
] [210])) -1
     (nil))

(insn 144 229 145 14 (set (reg/f:SI 1 r1 [238])
        (plus:SI (reg/f:SI 1 r1 [238])
            (reg/v/f:SI 8 r8 [orig:210 buf ] [210]))) yyy.c:25 35
{*addsi3_compact}
     (expr_list:REG_EQUAL (plus:SI (reg/v/f:SI 8 r8 [orig:210 buf ] [210])
            (const_int 2046 [0x7fe]))
        (nil)))

(insn 145 144 146 14 (set (reg:QI 2 r2 [240])
        (const_int 0 [0])) yyy.c:25 186 {movqi_i}
     (expr_list:REG_EQUIV (const_int 0 [0])
        (nil)))

(insn 146 145 38 14 (set (mem:QI (reg/f:SI 1 r1 [238]) [0 MEM[(char *)buf_1(D)
+ 2046B]+0 S1 A8])
        (reg:QI 2 r2 [240])) yyy.c:25 186 {movqi_i}
     (expr_list:REG_EQUAL (const_int 0 [0])
        (nil)))

When debug_insn 229 is absent, reload_combine_recognize_pattern
converts them to the insns like

(insn 143 141 145 14 (set (reg:SI 0 r0)
        (const_int 2046 [0x7fe])) xxx.c:25 176 {movsi_ie}
     (expr_list:REG_EQUAL (const_int 2046 [0x7fe])
        (nil)))

(insn 145 143 146 14 (set (reg:QI 2 r2 [240])
        (const_int 0 [0])) xxx.c:25 186 {movqi_i}
     (expr_list:REG_EQUIV (const_int 0 [0])
        (nil)))

(insn 146 145 38 14 (set (mem:QI (plus:SI (reg:SI 0 r0)
                (reg/v/f:SI 8 r8 [orig:210 buf ] [210])) [0 MEM[(char
*)buf_1(D) + 2046B]+0 S1 A8])
        (reg:QI 2 r2 [240])) xxx.c:25 186 {movqi_i}
     (expr_list:REG_EQUAL (const_int 0 [0])
        (nil)))

but this isn't done with debug_insn 229.
It seems that reload_combine_recognize_pattern only looks
prev_nonnote_insn of insn 145 as the candidate of
(set (REGX) (CONST_INT)) insn and the debug_insn confuses
it.  I've confirmed that the patch

--- ORIG/trunk/gcc/postreload.c 2010-07-28 09:38:05.000000000 +0900
+++ trunk/gcc/postreload.c      2010-07-30 08:42:50.000000000 +0900
@@ -1113,12 +1113,20 @@ reload_combine_recognize_pattern (rtx in
       && last_label_ruid < reg_state[regno].use_ruid)
     {
       rtx base = XEXP (src, 1);
-      rtx prev = prev_nonnote_insn (insn);
-      rtx prev_set = prev ? single_set (prev) : NULL_RTX;
+      rtx prev;
+      rtx prev_set;
       rtx index_reg = NULL_RTX;
       rtx reg_sum = NULL_RTX;
       int i;

+      /* Find the previous non-note/dubug insn.  */
+      prev = insn;
+      do {
+       prev = prev_nonnote_insn (prev);
+      } while (prev && DEBUG_INSN_P (prev));
+
+      prev_set = prev ? single_set (prev) : NULL_RTX;
+
       /* Now we need to set INDEX_REG to an index register (denoted as
         REGZ in the illustration above) and REG_SUM to the expression
         register+register that we want to use to substitute uses of REG

fixes the problem.
Perhaps {next,prev}_nonnote_nondebug_insn should be added
to emit-rtl.c and use it here.  Thoughts?


-- 

kkojima at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|-g changes the generated    |[4.6 Regression] -g changes
                   |code for gcc/sched-vis.c on |the generated code for
                   |SH                          |gcc/sched-vis.c on SH


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45137


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/45137] [4.6 Regression] -g changes the generated code for gcc/sched-vis.c on SH
  2010-07-30  0:47 [Bug rtl-optimization/45137] New: -g changes the generated code for gcc/sched-vis.c on SH kkojima at gcc dot gnu dot org
  2010-07-30  0:49 ` [Bug rtl-optimization/45137] " kkojima at gcc dot gnu dot org
  2010-07-30  0:50 ` [Bug rtl-optimization/45137] [4.6 Regression] " kkojima at gcc dot gnu dot org
@ 2010-07-30  9:42 ` rguenth at gcc dot gnu dot org
  2010-07-30 11:59 ` jakub 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 @ 2010-07-30  9:42 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.6.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45137


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/45137] [4.6 Regression] -g changes the generated code for gcc/sched-vis.c on SH
  2010-07-30  0:47 [Bug rtl-optimization/45137] New: -g changes the generated code for gcc/sched-vis.c on SH kkojima at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2010-07-30  9:42 ` rguenth at gcc dot gnu dot org
@ 2010-07-30 11:59 ` jakub at gcc dot gnu dot org
  2010-07-30 12:54 ` kkojima 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 @ 2010-07-30 11:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2010-07-30 11:59 -------
I agree, and after all, we had one of those two functions already, just private
to combine.c.
See the patch in PR45055.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45137


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/45137] [4.6 Regression] -g changes the generated code for gcc/sched-vis.c on SH
  2010-07-30  0:47 [Bug rtl-optimization/45137] New: -g changes the generated code for gcc/sched-vis.c on SH kkojima at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2010-07-30 11:59 ` jakub at gcc dot gnu dot org
@ 2010-07-30 12:54 ` kkojima at gcc dot gnu dot org
  2010-07-30 14:37 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2010-07-30 12:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from kkojima at gcc dot gnu dot org  2010-07-30 12:54 -------
I've confirmed that gcc46-pr45055.patch solves this PR too.
Thanks!


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45137


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/45137] [4.6 Regression] -g changes the generated code for gcc/sched-vis.c on SH
  2010-07-30  0:47 [Bug rtl-optimization/45137] New: -g changes the generated code for gcc/sched-vis.c on SH kkojima at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2010-07-30 12:54 ` kkojima at gcc dot gnu dot org
@ 2010-07-30 14:37 ` jakub at gcc dot gnu dot org
  2010-07-31  4:45 ` kkojima at gcc dot gnu dot org
  2010-08-12  9:15 ` jakub at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-07-30 14:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2010-07-30 14:37 -------
Subject: Bug 45137

Author: jakub
Date: Fri Jul 30 14:36:56 2010
New Revision: 162714

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162714
Log:
        PR debug/45055
        PR rtl-optimization/45137
        * rtl.h (prev_nonnote_nondebug_insn, next_nonnote_nondebug_insn): New
        prototypes.
        * emit-rtl.c (prev_nonnote_nondebug_insn, next_nonnote_nondebug_insn):
        New functions.
        * combine.c (next_nonnote_nondebug_insn): Removed.
        * ifcvt.c (noce_process_if_block): Use prev_nonnote_nondebug_insn.
        * haifa-sched.c (queue_to_ready): Use next_nonnote_nondebug_insn.
        * sched-deps.c (sched_analyze_insn): Likewise.
        (fixup_sched_groups, deps_start_bb): Use prev_nonnote_nondebug_insn.
        * rtlanal.c (canonicalize_condition): Likewise.
        * postreload.c (reload_combine_recognize_pattern): Likewise.
        (reload_cse_move2add): Use next_nonnote_nondebug_insn.

        * gcc.dg/pr45055.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr45055.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/combine.c
    trunk/gcc/emit-rtl.c
    trunk/gcc/haifa-sched.c
    trunk/gcc/ifcvt.c
    trunk/gcc/postreload.c
    trunk/gcc/rtl.h
    trunk/gcc/rtlanal.c
    trunk/gcc/sched-deps.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45137


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/45137] [4.6 Regression] -g changes the generated code for gcc/sched-vis.c on SH
  2010-07-30  0:47 [Bug rtl-optimization/45137] New: -g changes the generated code for gcc/sched-vis.c on SH kkojima at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2010-07-30 14:37 ` jakub at gcc dot gnu dot org
@ 2010-07-31  4:45 ` kkojima at gcc dot gnu dot org
  2010-08-12  9:15 ` jakub at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2010-07-31  4:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from kkojima at gcc dot gnu dot org  2010-07-31 04:45 -------
Fixed.


-- 

kkojima at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45137


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug rtl-optimization/45137] [4.6 Regression] -g changes the generated code for gcc/sched-vis.c on SH
  2010-07-30  0:47 [Bug rtl-optimization/45137] New: -g changes the generated code for gcc/sched-vis.c on SH kkojima at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2010-07-31  4:45 ` kkojima at gcc dot gnu dot org
@ 2010-08-12  9:15 ` jakub at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-08-12  9:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jakub at gcc dot gnu dot org  2010-08-12 09:15 -------
Subject: Bug 45137

Author: jakub
Date: Thu Aug 12 09:14:47 2010
New Revision: 163187

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163187
Log:
        Backport from mainline
        2010-07-30  Jakub Jelinek  <jakub@redhat.com>

        PR debug/45055
        PR rtl-optimization/45137
        * rtl.h (prev_nonnote_nondebug_insn, next_nonnote_nondebug_insn): New
        prototypes.
        * emit-rtl.c (prev_nonnote_nondebug_insn, next_nonnote_nondebug_insn):
        New functions.
        * combine.c (next_nonnote_nondebug_insn): Removed.
        * ifcvt.c (noce_process_if_block): Use prev_nonnote_nondebug_insn.
        * haifa-sched.c (queue_to_ready): Use next_nonnote_nondebug_insn.
        * sched-deps.c (sched_analyze_insn): Likewise.
        (fixup_sched_groups, deps_start_bb): Use prev_nonnote_nondebug_insn.
        * rtlanal.c (canonicalize_condition): Likewise.
        * postreload.c (reload_combine): Likewise.
        (reload_cse_move2add): Use next_nonnote_nondebug_insn.

        * gcc.dg/pr45055.c: New test.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/pr45055.c
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/combine.c
    branches/gcc-4_5-branch/gcc/emit-rtl.c
    branches/gcc-4_5-branch/gcc/haifa-sched.c
    branches/gcc-4_5-branch/gcc/ifcvt.c
    branches/gcc-4_5-branch/gcc/postreload.c
    branches/gcc-4_5-branch/gcc/rtl.h
    branches/gcc-4_5-branch/gcc/rtlanal.c
    branches/gcc-4_5-branch/gcc/sched-deps.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45137


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-08-12  9:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-30  0:47 [Bug rtl-optimization/45137] New: -g changes the generated code for gcc/sched-vis.c on SH kkojima at gcc dot gnu dot org
2010-07-30  0:49 ` [Bug rtl-optimization/45137] " kkojima at gcc dot gnu dot org
2010-07-30  0:50 ` [Bug rtl-optimization/45137] [4.6 Regression] " kkojima at gcc dot gnu dot org
2010-07-30  9:42 ` rguenth at gcc dot gnu dot org
2010-07-30 11:59 ` jakub at gcc dot gnu dot org
2010-07-30 12:54 ` kkojima at gcc dot gnu dot org
2010-07-30 14:37 ` jakub at gcc dot gnu dot org
2010-07-31  4:45 ` kkojima at gcc dot gnu dot org
2010-08-12  9:15 ` jakub 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).