From 04da56800d7dab3b3aee10b742328efc49ff3a4a Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Sat, 18 Jan 2014 10:12:22 +0000 Subject: [PATCH] jump.c (delete_related_insns): Keep (use (insn))s. gcc/ * jump.c (delete_related_insns): Keep (use (insn))s. * reorg.c (redundant_insn): Check for barriers too. From-SVN: r206749 --- gcc/ChangeLog | 5 +++++ gcc/jump.c | 7 +++++++ gcc/reorg.c | 5 ++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 01ba1fd4470..51d6cc6e8e4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-01-18 Richard Sandiford + + * jump.c (delete_related_insns): Keep (use (insn))s. + * reorg.c (redundant_insn): Check for barriers too. + 2014-01-17 H.J. Lu * config/i386/i386.c (ix86_split_lea_for_addr): Fix a comment diff --git a/gcc/jump.c b/gcc/jump.c index 40dfe6c250c..e6dabd05c5c 100644 --- a/gcc/jump.c +++ b/gcc/jump.c @@ -1355,6 +1355,13 @@ delete_related_insns (rtx insn) /* Keep going past other deleted labels to delete what follows. */ else if (code == CODE_LABEL && INSN_DELETED_P (next)) next = NEXT_INSN (next); + /* Keep the (use (insn))s created by dbr_schedule, which needs + them in order to track liveness relative to a previous + barrier. */ + else if (INSN_P (next) + && GET_CODE (PATTERN (next)) == USE + && INSN_P (XEXP (PATTERN (next), 0))) + next = NEXT_INSN (next); else if (code == BARRIER || INSN_P (next)) /* Note: if this deletes a jump, it can cause more deletion of unreachable code, after a different label. diff --git a/gcc/reorg.c b/gcc/reorg.c index de332323ae1..054304a188a 100644 --- a/gcc/reorg.c +++ b/gcc/reorg.c @@ -1512,7 +1512,10 @@ redundant_insn (rtx insn, rtx target, rtx delay_list) trial && insns_to_search > 0; trial = PREV_INSN (trial)) { - if (LABEL_P (trial)) + /* (use (insn))s can come immediately after a barrier if the + label that used to precede them has been deleted as dead. + See delete_related_insns. */ + if (LABEL_P (trial) || BARRIER_P (trial)) return 0; if (!INSN_P (trial))