This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: fix different code depending on '-g'


Hi,

During testing I found a case (gcc.c-torture/execute/loop-2b.c), which
produces different code on m68k depending '-g'. With '-g' this is
generated:

(jump_insn 35 34 36 (set (pc)
        (if_then_else (ne:CC (cc0)
                (const_int 0 [0x0]))
            (label_ref 39)
            (pc))) -1 (nil)
    (nil))

(note 36 35 49 ("/old/src/gcc/egcs/gcc/testsuite/gcc.c-torture/execute/loop-2b.c") 11)

(note 49 36 50 NOTE_INSN_LOOP_END)

This pattern can also be found in i686 rtl, but I haven't seen a
difference in the code. Anyway, the problem is the last test in
cse_basic_block. Without '-g' the line note is missing and PREV_INSN is
different.
I bootstrapped the patch on mainline and branch for i686-linux and run
tests for the branch.

bye, Roman

2001-07-23  Roman Zippel  <zippel@linux-m68k.org>

	* cse.c (cse_basic_block): skip note instructions

Index: gcc/cse.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cse.c,v
retrieving revision 1.194
diff -u -r1.194 cse.c
--- cse.c	2001/07/18 18:52:41	1.194
+++ cse.c	2001/07/23 16:19:09
@@ -7353,14 +7353,15 @@
      we can cse into the loop.  Don't do this if we changed the jump
      structure of a loop unless we aren't going to be following jumps.  */

+  insn = prev_nonnote_insn(to);
   if ((cse_jumps_altered == 0
        || (flag_cse_follow_jumps == 0 && flag_cse_skip_blocks == 0))
       && around_loop && to != 0
       && GET_CODE (to) == NOTE && NOTE_LINE_NUMBER (to) == NOTE_INSN_LOOP_END
-      && GET_CODE (PREV_INSN (to)) == JUMP_INSN
-      && JUMP_LABEL (PREV_INSN (to)) != 0
-      && LABEL_NUSES (JUMP_LABEL (PREV_INSN (to))) == 1)
-    cse_around_loop (JUMP_LABEL (PREV_INSN (to)));
+      && GET_CODE (insn) == JUMP_INSN
+      && JUMP_LABEL (insn) != 0
+      && LABEL_NUSES (JUMP_LABEL (insn)) == 1)
+    cse_around_loop (JUMP_LABEL (insn));

   free (qty_table + max_reg);




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]