This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[3.3/mainline] fix bug in GCSE
- From: Josef Zlomek <zlomj9am at artax dot karlin dot mff dot cuni dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 3 Aug 2003 21:04:37 +0200
- Subject: [3.3/mainline] fix bug in GCSE
Hi,
this patch fixes a bug in GCSE which prevented to do constant
propagation is some cases (multiplication of double constants).
The problem was that the register in REG_EQUAL note was not replaced
by the constant in some cases.
This patch fixes updating of the note.
Bootstrapped/regtested 3.3 branch and mainline on x86-64.
Josef
2003-08-03 Josef Zlomek <zlomekj@suse.cz>
* gcse.c (try_replace_reg): Fix updating of note.
Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.222.2.14
diff -c -3 -p -r1.222.2.14 gcse.c
*** gcse.c 30 Jul 2003 23:02:06 -0000 1.222.2.14
--- gcse.c 2 Aug 2003 16:19:35 -0000
*************** try_replace_reg (from, to, insn)
*** 3949,3954 ****
--- 3949,3959 ----
validate_change (insn, &SET_SRC (set), src, 0);
}
+ /* If there is already a NOTE, update the expression in it with our
+ replacement. */
+ if (note != 0)
+ XEXP (note, 0) = simplify_replace_rtx (XEXP (note, 0), from, to);
+
if (!success && set && reg_mentioned_p (from, SET_SRC (set)))
{
/* If above failed and this is a single set, try to simplify the source of
*************** try_replace_reg (from, to, insn)
*** 3965,3975 ****
if (!success && note == 0 && set != 0)
note = set_unique_reg_note (insn, REG_EQUAL, copy_rtx (src));
}
-
- /* If there is already a NOTE, update the expression in it with our
- replacement. */
- else if (note != 0)
- XEXP (note, 0) = simplify_replace_rtx (XEXP (note, 0), from, to);
/* REG_EQUAL may get simplified into register.
We don't allow that. Remove that note. This code ought
--- 3970,3975 ----