Commit 9baea66c by Eric Botcazou Committed by Eric Botcazou

re PR rtl-optimization/41511 (combine behaves differently with/without -g)

	PR rtl-optimization/41511
	* combine.c (record_value_for_reg): Pass explicit values as argument
	to get_last_value_validate.
	(get_last_value_validate): Document INSN parameter.
	For non-readonly MEMs, assume they might have been modified if INSN
	was in another basic block.
	(get_last_value): Minor reformatting.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r152459
parent 2bd1d2c8
2009-10-05 Eric Botcazou <ebotcazou@adacore.com>
Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/41511
* combine.c (record_value_for_reg): Pass explicit values as argument
to get_last_value_validate.
(get_last_value_validate): Document INSN parameter.
For non-readonly MEMs, assume they might have been modified if INSN
was in another basic block.
(get_last_value): Minor reformatting.
2009-10-05 Andrew Pinski <andrew_pinski@playstation.sony.com> 2009-10-05 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR tree-opt/40992 PR tree-opt/40992
...@@ -11758,12 +11758,10 @@ record_value_for_reg (rtx reg, rtx insn, rtx value) ...@@ -11758,12 +11758,10 @@ record_value_for_reg (rtx reg, rtx insn, rtx value)
case, we must replace it with (clobber (const_int 0)) to prevent case, we must replace it with (clobber (const_int 0)) to prevent
infinite loops. */ infinite loops. */
rsp = VEC_index (reg_stat_type, reg_stat, regno); rsp = VEC_index (reg_stat_type, reg_stat, regno);
if (value && ! get_last_value_validate (&value, insn, if (value && !get_last_value_validate (&value, insn, label_tick, 0))
rsp->last_set_label, 0))
{ {
value = copy_rtx (value); value = copy_rtx (value);
if (! get_last_value_validate (&value, insn, if (!get_last_value_validate (&value, insn, label_tick, 1))
rsp->last_set_label, 1))
value = 0; value = 0;
} }
...@@ -12055,15 +12053,14 @@ check_promoted_subreg (rtx insn, rtx x) ...@@ -12055,15 +12053,14 @@ check_promoted_subreg (rtx insn, rtx x)
} }
} }
/* Utility routine for the following function. Verify that all the registers /* Verify that all the registers and memory references mentioned in *LOC are
mentioned in *LOC are valid when *LOC was part of a value set when still valid. *LOC was part of a value set in INSN when label_tick was
label_tick == TICK. Return 0 if some are not. equal to TICK. Return 0 if some are not. If REPLACE is nonzero, replace
the invalid references with (clobber (const_int 0)) and return 1. This
If REPLACE is nonzero, replace the invalid reference with replacement is useful because we often can get useful information about
(clobber (const_int 0)) and return 1. This replacement is useful because the form of a value (e.g., if it was produced by a shift that always
we often can get useful information about the form of a value (e.g., if produces -1 or 0) even though we don't know exactly what registers it
it was produced by a shift that always produces -1 or 0) even though was produced from. */
we don't know exactly what registers it was produced from. */
static int static int
get_last_value_validate (rtx *loc, rtx insn, int tick, int replace) get_last_value_validate (rtx *loc, rtx insn, int tick, int replace)
...@@ -12099,11 +12096,12 @@ get_last_value_validate (rtx *loc, rtx insn, int tick, int replace) ...@@ -12099,11 +12096,12 @@ get_last_value_validate (rtx *loc, rtx insn, int tick, int replace)
return 1; return 1;
} }
/* If this is a memory reference, make sure that there were /* If this is a memory reference, make sure that there were no stores after
no stores after it that might have clobbered the value. We don't it that might have clobbered the value. We don't have alias info, so we
have alias info, so we assume any store invalidates it. */ assume any store invalidates it. Moreover, we only have local UIDs, so
we also assume that there were stores in the intervening basic blocks. */
else if (MEM_P (x) && !MEM_READONLY_P (x) else if (MEM_P (x) && !MEM_READONLY_P (x)
&& DF_INSN_LUID (insn) <= mem_last_set) && (tick != label_tick || DF_INSN_LUID (insn) <= mem_last_set))
{ {
if (replace) if (replace)
*loc = gen_rtx_CLOBBER (GET_MODE (x), const0_rtx); *loc = gen_rtx_CLOBBER (GET_MODE (x), const0_rtx);
...@@ -12213,16 +12211,14 @@ get_last_value (const_rtx x) ...@@ -12213,16 +12211,14 @@ get_last_value (const_rtx x)
return 0; return 0;
/* If the value has all its registers valid, return it. */ /* If the value has all its registers valid, return it. */
if (get_last_value_validate (&value, rsp->last_set, if (get_last_value_validate (&value, rsp->last_set, rsp->last_set_label, 0))
rsp->last_set_label, 0))
return value; return value;
/* Otherwise, make a copy and replace any invalid register with /* Otherwise, make a copy and replace any invalid register with
(clobber (const_int 0)). If that fails for some reason, return 0. */ (clobber (const_int 0)). If that fails for some reason, return 0. */
value = copy_rtx (value); value = copy_rtx (value);
if (get_last_value_validate (&value, rsp->last_set, if (get_last_value_validate (&value, rsp->last_set, rsp->last_set_label, 1))
rsp->last_set_label, 1))
return value; return value;
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment