]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* gcse.c (struct reg_use): Remove unused struct.
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Dec 2012 23:28:42 +0000 (23:28 +0000)
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Dec 2012 23:28:42 +0000 (23:28 +0000)
(gcse_emit_move_after): Do not create REG_EQUAL notes that reference
the SET_DEST of the instruction the note would be attached to.
* cse.c (cse_main): Add the DF_NOTE problem.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194108 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cse.c
gcc/gcse.c

index 8c7af76284cde221eace934e455ccf317cc7619b..65dfd9a9a750544421573c95e8ef9a2d0f1281e8 100644 (file)
@@ -1,3 +1,10 @@
+2012-12-03  Steven Bosscher  <steven@gcc.gnu.org>
+
+       * gcse.c (struct reg_use): Remove unused struct.
+       (gcse_emit_move_after): Do not create REG_EQUAL notes that reference
+       the SET_DEST of the instruction the note would be attached to.
+       * cse.c (cse_main): Add the DF_NOTE problem.
+
 2012-12-03  Jakub Jelinek  <jakub@redhat.com>
 
        * sanitizer.def: Add Address Sanitizer builtins.
index ff91b9d93f54d8f8de178240221645428931a37c..34b318c6919926f76a617193277d151282ab95fc 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -6520,6 +6520,7 @@ cse_main (rtx f ATTRIBUTE_UNUSED, int nregs)
   int i, n_blocks;
 
   df_set_flags (DF_LR_RUN_DCE);
+  df_note_add_problem ();
   df_analyze ();
   df_set_flags (DF_DEFER_INSN_RESCAN);
 
index ee45b6544f96733065c43fa8014b972f952c99ff..4a426a3528c80d6ce90309d6d6cbfaae95e4a28b 100644 (file)
@@ -255,8 +255,6 @@ int flag_rerun_cse_after_global_opts;
 /* An obstack for our working variables.  */
 static struct obstack gcse_obstack;
 
-struct reg_use {rtx reg_rtx; };
-
 /* Hash table of expressions.  */
 
 struct expr
@@ -2491,23 +2489,27 @@ gcse_emit_move_after (rtx dest, rtx src, rtx insn)
   rtx new_rtx;
   rtx set = single_set (insn), set2;
   rtx note;
-  rtx eqv;
+  rtx eqv = NULL_RTX;
 
   /* This should never fail since we're creating a reg->reg copy
      we've verified to be valid.  */
 
   new_rtx = emit_insn_after (gen_move_insn (dest, src), insn);
 
-  /* Note the equivalence for local CSE pass.  */
+  /* Note the equivalence for local CSE pass.  Take the note from the old
+     set if there was one.  Otherwise record the SET_SRC from the old set
+     unless DEST is also an operand of the SET_SRC.  */
   set2 = single_set (new_rtx);
   if (!set2 || !rtx_equal_p (SET_DEST (set2), dest))
     return new_rtx;
   if ((note = find_reg_equal_equiv_note (insn)))
     eqv = XEXP (note, 0);
-  else
+  else if (! REG_P (dest)
+          || ! reg_mentioned_p (dest, SET_SRC (set)))
     eqv = SET_SRC (set);
 
-  set_unique_reg_note (new_rtx, REG_EQUAL, copy_insn_1 (eqv));
+  if (eqv != NULL_RTX)
+    set_unique_reg_note (new_rtx, REG_EQUAL, copy_insn_1 (eqv));
 
   return new_rtx;
 }