* cse.c (cse_insn): Avoid redundant REG_EQUAL notes.
authorRoger Sayle <roger@eyesopen.com>
Tue, 28 Jan 2003 14:52:07 +0000 (14:52 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Tue, 28 Jan 2003 14:52:07 +0000 (14:52 +0000)
From-SVN: r61971

gcc/ChangeLog
gcc/cse.c

index 2fcc66f83cc60b4bd064769a905c8dd57079cffa..626823b06f37ba2743543bd3349ad6f8f10aa05f 100644 (file)
@@ -1,3 +1,7 @@
+2003-01-28  Roger Sayle  <roger@eyesopen.com>
+
+       * cse.c (cse_insn): Avoid redundant REG_EQUAL notes.
+
 2003-01-28  Richard Sandiford  <rsandifo@redhat.com>
 
        * config/sh/sh.h (CLASS_MAX_NREGS): If TARGET_SHMEDIA, and the given
index 84210babcbd5fb7494574899eed60ab33981b456..e396042111ee31beded4ca9619e3fb27e66bc63e 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -5684,12 +5684,16 @@ cse_insn (insn, libcall_insn)
                && GET_CODE (XEXP (XEXP (src_const, 0), 0)) == LABEL_REF
                && GET_CODE (XEXP (XEXP (src_const, 0), 1)) == LABEL_REF))
        {
-         /* Make sure that the rtx is not shared with any other insn.  */
-         src_const = copy_rtx (src_const);
+         /* We only want a REG_EQUAL note if src_const != src.  */
+         if (! rtx_equal_p (src, src_const))
+           {
+             /* Make sure that the rtx is not shared.  */
+             src_const = copy_rtx (src_const);
 
-         /* Record the actual constant value in a REG_EQUAL note, making
-            a new one if one does not already exist.  */
-         set_unique_reg_note (insn, REG_EQUAL, src_const);
+             /* Record the actual constant value in a REG_EQUAL note,
+                making a new one if one does not already exist.  */
+             set_unique_reg_note (insn, REG_EQUAL, src_const);
+           }
 
          /* If storing a constant value in a register that
             previously held the constant value 0,