This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH,updated] PR35371 GCSE loses track of REG_POINTER attribute
- From: Peter Bergner <bergner at vnet dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 25 Feb 2008 22:27:35 -0600
- Subject: Re: [PATCH,updated] PR35371 GCSE loses track of REG_POINTER attribute
- References: <20080225222624.GA26857@vervain.rchland.ibm.com>
It seems we're not always passed a reg rtx the comments would seem to
imply. I've updated the patch to handle that. Bootstrap and regression
testing is in progress again.
Is this patch ok for mainline once bootstrap and regression testing have
completed? Given PR28690 was a 4.3 regression, is this ok for 4.3.1 once
that is open for fixes?
Peter
PR rtl-optimization/35371
* gcse.c (gen_reaching_reg_rtx): New function.
(pre_delete): Use it.
(hoist_code): Likewise.
(build_store_vectors): Likewise.
(delete_store): Likewise.
Index: gcse.c
===================================================================
--- gcse.c (revision 132568)
+++ gcse.c (working copy)
@@ -818,6 +818,22 @@ gcse_main (rtx f ATTRIBUTE_UNUSED)
/* Misc. utilities. */
+/* Create a pseudo reg to copy the result of a reaching expression into.
+ Be careful to inherit the REG_POINTER attribute. */
+
+static rtx
+gen_reaching_reg_rtx (rtx x)
+{
+ rtx reg = gen_reg_rtx (GET_MODE (x));
+
+ if (REG_P (x) && REG_POINTER (x))
+ mark_reg_pointer (reg, REGNO_POINTER_ALIGN (REGNO (x)));
+ else if (MEM_P (x) && MEM_POINTER (x))
+ mark_reg_pointer (reg, MEM_ALIGN (x));
+
+ return reg;
+}
+
/* Nonzero for each mode that supports (set (reg) (reg)).
This is trivially true for integer and floating point values.
It may or may not be true for condition codes. */
@@ -4456,8 +4472,7 @@ pre_delete (void)
expressions into. Get the mode for the new pseudo from
the mode of the original destination pseudo. */
if (expr->reaching_reg == NULL)
- expr->reaching_reg
- = gen_reg_rtx (GET_MODE (SET_DEST (set)));
+ expr->reaching_reg = gen_reaching_reg_rtx (SET_DEST (set));
gcse_emit_move_after (expr->reaching_reg, SET_DEST (set), insn);
delete_insn (insn);
@@ -4981,7 +4996,7 @@ hoist_code (void)
from the mode of the original destination pseudo. */
if (expr->reaching_reg == NULL)
expr->reaching_reg
- = gen_reg_rtx (GET_MODE (SET_DEST (set)));
+ = gen_reaching_reg_rtx (SET_DEST (set));
gcse_emit_move_after (expr->reaching_reg, SET_DEST (set), insn);
delete_insn (insn);
@@ -6114,7 +6129,7 @@ build_store_vectors (void)
are any side effects. */
if (TEST_BIT (ae_gen[bb->index], ptr->index))
{
- rtx r = gen_reg_rtx (GET_MODE (ptr->pattern));
+ rtx r = gen_reaching_reg_rtx (ptr->pattern);
if (dump_file)
fprintf (dump_file, "Removing redundant store:\n");
replace_store_insn (r, XEXP (st, 0), bb, ptr);
@@ -6437,7 +6452,7 @@ delete_store (struct ls_expr * expr, bas
rtx reg, i, del;
if (expr->reaching_reg == NULL_RTX)
- expr->reaching_reg = gen_reg_rtx (GET_MODE (expr->pattern));
+ expr->reaching_reg = gen_reaching_reg_rtx (expr->pattern);
reg = expr->reaching_reg;