From f827f65933319275c46eccf2aa1df4f1d21d6783 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Thu, 21 Jan 2010 00:42:02 +0000 Subject: re PR other/42715 (output_operand: invalid expression as operand) PR debug/42715 * var-tracking.c (use_type): Choose MO_VAL_SET for REGs set without a cselib val. (count_uses): Accept MO_VAL_SET with no val on stores. (add_stores): Likewise. * gcc.dg/pr42715.c: New. From-SVN: r156102 --- gcc/var-tracking.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'gcc/var-tracking.c') diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index 5ac3222e140..79e8d560895 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -4426,7 +4426,6 @@ static enum micro_operation_type use_type (rtx loc, struct count_use_info *cui, enum machine_mode *modep) { tree expr; - cselib_val *val; if (cui && cui->sets) { @@ -4447,19 +4446,24 @@ use_type (rtx loc, struct count_use_info *cui, enum machine_mode *modep) return MO_CLOBBER; } - if ((REG_P (loc) || MEM_P (loc)) - && (val = find_use_val (loc, GET_MODE (loc), cui))) + if (REG_P (loc) || MEM_P (loc)) { if (modep) *modep = GET_MODE (loc); if (cui->store_p) { if (REG_P (loc) - || cselib_lookup (XEXP (loc, 0), GET_MODE (loc), 0)) + || (find_use_val (loc, GET_MODE (loc), cui) + && cselib_lookup (XEXP (loc, 0), GET_MODE (loc), 0))) return MO_VAL_SET; } - else if (!cselib_preserved_value_p (val)) - return MO_VAL_USE; + else + { + cselib_val *val = find_use_val (loc, GET_MODE (loc), cui); + + if (val && !cselib_preserved_value_p (val)) + return MO_VAL_USE; + } } } @@ -4580,7 +4584,8 @@ count_uses (rtx *ploc, void *cuip) cselib_preserve_value (val); } else - gcc_assert (mopt == MO_VAL_LOC); + gcc_assert (mopt == MO_VAL_LOC + || (mopt == MO_VAL_SET && cui->store_p)); break; @@ -4968,6 +4973,9 @@ add_stores (rtx loc, const_rtx expr, void *cuip) v = find_use_val (oloc, mode, cui); + if (!v) + goto log_and_return; + resolve = preserve = !cselib_preserved_value_p (v); nloc = replace_expr_with_values (oloc); -- cgit v1.2.1