This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Avoid emitting useless notes in GCSE
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 30 Mar 2005 14:24:34 +0200
- Subject: [PATCH] Avoid emitting useless notes in GCSE
Hello,
While working on an unrelated problem, it occured to me that GCSE can emit
seemingly useless REG_EQUAL notes, that is to say REQ_EQUAL notes that
contain the copy of the source of the SET they are attached to.
Is there any benefit in doing so? If no, I propose the attached patch for
mainline (I'll properly test it if it is okayed on principle).
2005-03-30 Eric Botcazou <ebotcazou@adacore.com>
* gcse.c (try_replace_reg): Do not emit a REG_EQUAL note if the source
of the SET has not been modified.
--
Eric Botcazou
Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.337
diff -u -p -r1.337 gcse.c
--- gcse.c 11 Mar 2005 09:04:58 -0000 1.337
+++ gcse.c 30 Mar 2005 12:09:47 -0000
@@ -2656,16 +2656,18 @@ try_replace_reg (rtx from, rtx to, rtx i
SETs, but it probably won't buy us anything. */
src = simplify_replace_rtx (SET_SRC (set), from, to);
- if (!rtx_equal_p (src, SET_SRC (set))
- && validate_change (insn, &SET_SRC (set), src, 0))
- success = 1;
-
- /* If we've failed to do replacement, have a single SET, don't already
- have a note, and have no special SET, add a REG_EQUAL note to not
- lose information. */
- if (!success && note == 0 && set != 0
- && GET_CODE (SET_DEST (set)) != ZERO_EXTRACT)
- note = set_unique_reg_note (insn, REG_EQUAL, copy_rtx (src));
+ if (!rtx_equal_p (src, SET_SRC (set)))
+ {
+ if (validate_change (insn, &SET_SRC (set), src, 0))
+ success = 1;
+
+ /* If we've failed to do replacement, have a single SET, don't
+ already have a note, and have no special SET, add a REG_EQUAL
+ note to not lose information. */
+ if (!success && note == 0 && set != 0
+ && GET_CODE (SET_DEST (set)) != ZERO_EXTRACT)
+ note = set_unique_reg_note (insn, REG_EQUAL, copy_rtx (src));
+ }
}
/* REG_EQUAL may get simplified into register.