Properly limit backwards label scanning in reorg.

* reorg.c (label_before_next_insn): New function.
	(relax_delay_slots): Use it instead of prev_label.
	* rtl.h (prev_label): Delete declaration.
	* emit-rtl.c (prev_label): Remove.

From-SVN: r180674
This commit is contained in:
David S. Miller 2011-10-30 07:48:05 +00:00 committed by David S. Miller
parent cc1efdff70
commit dbeee82924
4 changed files with 23 additions and 17 deletions

View File

@ -1,3 +1,10 @@
2011-10-30 David S. Miller <davem@davemloft.net>
* reorg.c (label_before_next_insn): New function.
(relax_delay_slots): Use it instead of prev_label.
* rtl.h (prev_label): Delete declaration.
* emit-rtl.c (prev_label): Remove.
2011-10-30 Revital Eres <revital.eres@linaro.org>
* modulo-sched.c (generate_prolog_epilog): Mark prolog and epilog

View File

@ -3330,21 +3330,6 @@ next_label (rtx insn)
return insn;
}
/* Return the last CODE_LABEL before the insn INSN, or 0 if there is none. */
rtx
prev_label (rtx insn)
{
while (insn)
{
insn = PREV_INSN (insn);
if (insn == 0 || LABEL_P (insn))
break;
}
return insn;
}
/* Return the last label to mark the same position as LABEL. Return LABEL
itself if it is null or any return rtx. */

View File

@ -3349,6 +3349,21 @@ delete_jump (rtx insn)
delete_computation (insn);
}
static rtx
label_before_next_insn (rtx x, rtx scan_limit)
{
rtx insn = next_active_insn (x);
while (insn)
{
insn = PREV_INSN (insn);
if (insn == scan_limit || insn == NULL_RTX)
return NULL_RTX;
if (LABEL_P (insn))
break;
}
return insn;
}
/* Once we have tried two ways to fill a delay slot, make a pass over the
code to try to improve the results and to do such things as more jump
@ -3634,7 +3649,7 @@ relax_delay_slots (rtx first)
identical to the one in its delay slot. In this case, we can just
delete the branch and the insn in its delay slot. */
if (next && NONJUMP_INSN_P (next)
&& prev_label (next_active_insn (next)) == target_label
&& label_before_next_insn (next, insn) == target_label
&& simplejump_p (insn)
&& XVECLEN (pat, 0) == 2
&& rtx_equal_p (PATTERN (next), PATTERN (XVECEXP (pat, 0, 1))))

View File

@ -1812,7 +1812,6 @@ extern rtx next_real_insn (rtx);
extern rtx prev_active_insn (rtx);
extern rtx next_active_insn (rtx);
extern int active_insn_p (const_rtx);
extern rtx prev_label (rtx);
extern rtx next_label (rtx);
extern rtx skip_consecutive_labels (rtx);
extern rtx next_cc0_user (rtx);