From caba7aaaa7306157ccdae7874b3430290a004ffa Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 19 May 2010 21:08:53 +0000 Subject: [PATCH] combine.c (propagate_for_debug): Call make_compound_operation on the source value. gcc/ * combine.c (propagate_for_debug): Call make_compound_operation on the source value. (try_combine): When implementing a split chosen by find_split_point, either copy i2src or set it to null. Assert that i2src is not null before substituting into CALL_INSN_FUNCTION_USAGE. From-SVN: r159600 --- gcc/ChangeLog | 8 ++++++++ gcc/combine.c | 23 ++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e215a91fba8..47a313a6a51 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2010-05-19 Richard Sandiford + + * combine.c (propagate_for_debug): Call make_compound_operation + on the source value. + (try_combine): When implementing a split chosen by find_split_point, + either copy i2src or set it to null. Assert that i2src is not null + before substituting into CALL_INSN_FUNCTION_USAGE. + 2010-05-19 Anatoly Sokolov * double-int.h (double_int_ior): New function. diff --git a/gcc/combine.c b/gcc/combine.c index 303f180f790..8aa7e94a852 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -2310,6 +2310,7 @@ static void propagate_for_debug (rtx insn, rtx last, rtx dest, rtx src, bool move) { rtx next, move_pos = move ? last : NULL_RTX, loc; + bool first_p; #ifdef AUTO_INC_DEC struct rtx_subst_pair p; @@ -2318,6 +2319,7 @@ propagate_for_debug (rtx insn, rtx last, rtx dest, rtx src, bool move) p.after = move; #endif + first_p = true; next = NEXT_INSN (insn); while (next != last) { @@ -2325,6 +2327,11 @@ propagate_for_debug (rtx insn, rtx last, rtx dest, rtx src, bool move) next = NEXT_INSN (insn); if (DEBUG_INSN_P (insn)) { + if (first_p) + { + src = make_compound_operation (src, SET); + first_p = false; + } #ifdef AUTO_INC_DEC loc = simplify_replace_fn_rtx (INSN_VAR_LOCATION_LOC (insn), dest, propagate_for_debug_subst, &p); @@ -3294,6 +3301,14 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) i2scratch = true; + /* *SPLIT may be part of I2SRC, so make sure we have the + original expression around for later debug processing. + We should not need I2SRC any more in other cases. */ + if (MAY_HAVE_DEBUG_INSNS) + i2src = copy_rtx (i2src); + else + i2src = NULL; + /* Get NEWDEST as a register in the proper mode. We have already validated that we can do this. */ if (GET_MODE (i2dest) != split_mode && split_mode != VOIDmode) @@ -3790,7 +3805,13 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) call_usage = copy_rtx (call_usage); if (substed_i2) - replace_rtx (call_usage, i2dest, i2src); + { + /* I2SRC must still be meaningful at this point. Some splitting + operations can invalidate I2SRC, but those operations do not + apply to calls. */ + gcc_assert (i2src); + replace_rtx (call_usage, i2dest, i2src); + } if (substed_i1) replace_rtx (call_usage, i1dest, i1src); -- 2.30.2