From 8f06d483ec378303875dbc393e6b112c18604330 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sun, 21 Aug 2011 11:49:49 -0700 Subject: rtl.h (INSN_ANNULLED_BRANCH_P): Only allow JUMP_INSN. * rtl.h (INSN_ANNULLED_BRANCH_P): Only allow JUMP_INSN. * dwarf2cfi.c (scan_trace): Test JUMP_P before INSN_ANNULLED_BRANCH_P. * resource.c (next_insn_no_annul): Likewise. (mark_set_resources): Likewise. * reorg.c (delete_from_delay_slot): Likewise. (dbr_schedule, redundant_insn, try_merge_delay_insns): Likewise. (get_branch_condition): Test pc_rtx and LABEL_REF before dereferencing. From-SVN: r177944 --- gcc/resource.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'gcc/resource.c') diff --git a/gcc/resource.c b/gcc/resource.c index 8380111..ae541fe 100644 --- a/gcc/resource.c +++ b/gcc/resource.c @@ -171,7 +171,7 @@ next_insn_no_annul (rtx insn) { /* If INSN is an annulled branch, skip any insns from the target of the branch. */ - if (INSN_P (insn) + if (JUMP_P (insn) && INSN_ANNULLED_BRANCH_P (insn) && NEXT_INSN (PREV_INSN (insn)) != insn) { @@ -710,10 +710,18 @@ mark_set_resources (rtx x, struct resources *res, int in_dest, return; case SEQUENCE: - for (i = 0; i < XVECLEN (x, 0); i++) - if (! (INSN_ANNULLED_BRANCH_P (XVECEXP (x, 0, 0)) - && INSN_FROM_TARGET_P (XVECEXP (x, 0, i)))) - mark_set_resources (XVECEXP (x, 0, i), res, 0, mark_type); + { + rtx control = XVECEXP (x, 0, 0); + bool annul_p = JUMP_P (control) && INSN_ANNULLED_BRANCH_P (control); + + mark_set_resources (control, res, 0, mark_type); + for (i = XVECLEN (x, 0) - 1; i >= 0; --i) + { + rtx elt = XVECEXP (x, 0, i); + if (!annul_p && INSN_FROM_TARGET_P (elt)) + mark_set_resources (elt, res, 0, mark_type); + } + } return; case POST_INC: -- cgit v1.1