aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2009-10-05 17:48:09 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2009-10-05 17:48:09 +0000
commit9baea66c9414e6fef0587cd47c80d858c31dbc5c (patch)
tree4b4f102b554c227bdf564242638a20d03b2008d9
parent2bd1d2c8d2d026168111295dc53d604856b74deb (diff)
downloadgcc-9baea66c9414e6fef0587cd47c80d858c31dbc5c.zip
gcc-9baea66c9414e6fef0587cd47c80d858c31dbc5c.tar.gz
gcc-9baea66c9414e6fef0587cd47c80d858c31dbc5c.tar.bz2
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
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/combine.c38
2 files changed, 28 insertions, 21 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 096db82..938b336 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+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>
PR tree-opt/40992
diff --git a/gcc/combine.c b/gcc/combine.c
index 64cf992..60c4059 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -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
infinite loops. */
rsp = VEC_index (reg_stat_type, reg_stat, regno);
- if (value && ! get_last_value_validate (&value, insn,
- rsp->last_set_label, 0))
+ if (value && !get_last_value_validate (&value, insn, label_tick, 0))
{
value = copy_rtx (value);
- if (! get_last_value_validate (&value, insn,
- rsp->last_set_label, 1))
+ if (!get_last_value_validate (&value, insn, label_tick, 1))
value = 0;
}
@@ -12055,15 +12053,14 @@ check_promoted_subreg (rtx insn, rtx x)
}
}
-/* Utility routine for the following function. Verify that all the registers
- mentioned in *LOC are valid when *LOC was part of a value set when
- label_tick == TICK. Return 0 if some are not.
-
- If REPLACE is nonzero, replace the invalid reference with
- (clobber (const_int 0)) and return 1. This replacement is useful because
- we often can get useful information about the form of a value (e.g., if
- it was produced by a shift that always produces -1 or 0) even though
- we don't know exactly what registers it was produced from. */
+/* Verify that all the registers and memory references mentioned in *LOC are
+ still valid. *LOC was part of a value set in INSN when label_tick was
+ 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
+ replacement is useful because we often can get useful information about
+ the form of a value (e.g., if it was produced by a shift that always
+ produces -1 or 0) even though we don't know exactly what registers it
+ was produced from. */
static int
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;
}
- /* If this is a memory reference, make sure that there were
- no stores after it that might have clobbered the value. We don't
- have alias info, so we assume any store invalidates it. */
+ /* If this is a memory reference, make sure that there were no stores after
+ it that might have clobbered the value. We don't have alias info, so we
+ 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)
- && DF_INSN_LUID (insn) <= mem_last_set)
+ && (tick != label_tick || DF_INSN_LUID (insn) <= mem_last_set))
{
if (replace)
*loc = gen_rtx_CLOBBER (GET_MODE (x), const0_rtx);
@@ -12213,16 +12211,14 @@ get_last_value (const_rtx x)
return 0;
/* If the value has all its registers valid, return it. */
- if (get_last_value_validate (&value, rsp->last_set,
- rsp->last_set_label, 0))
+ if (get_last_value_validate (&value, rsp->last_set, rsp->last_set_label, 0))
return value;
/* Otherwise, make a copy and replace any invalid register with
(clobber (const_int 0)). If that fails for some reason, return 0. */
value = copy_rtx (value);
- if (get_last_value_validate (&value, rsp->last_set,
- rsp->last_set_label, 1))
+ if (get_last_value_validate (&value, rsp->last_set, rsp->last_set_label, 1))
return value;
return 0;