Commit bf6302f0 by Herman A.J. ten Brugge Committed by Jeff Law

reorg.c (find_end_label): If the basic block reorder pass moves the return insn…

reorg.c (find_end_label): If the basic block reorder pass moves the return insn to some other place try...


	* reorg.c (find_end_label): If the basic block reorder pass moves the
	return insn to some other place try to locate it again and put our
	end_of_function_label there.
	* reorg.c (relax_delay_slots): Check if find_end_label created a
	new label that invalidates the current optimazation.

From-SVN: r36237
parent 33b35a8d
2000-09-07 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>
* reorg.c (find_end_label): If the basic block reorder pass moves the
return insn to some other place try to locate it again and put our
end_of_function_label there.
* reorg.c (relax_delay_slots): Check if find_end_label created a
new label that invalidates the current optimazation.
2000-09-07 Catherine Moore <clm@redhat.com> 2000-09-07 Catherine Moore <clm@redhat.com>
* unroll.c (unroll_loop): Check for unconditional jumps * unroll.c (unroll_loop): Check for unconditional jumps
......
...@@ -375,10 +375,29 @@ find_end_label () ...@@ -375,10 +375,29 @@ find_end_label ()
end_of_function_label = insn; end_of_function_label = insn;
else else
{ {
/* Otherwise, make a new label and emit a RETURN and BARRIER,
if needed. */
end_of_function_label = gen_label_rtx (); end_of_function_label = gen_label_rtx ();
LABEL_NUSES (end_of_function_label) = 0; LABEL_NUSES (end_of_function_label) = 0;
/* If the basic block reorder pass moves the return insn to
some other place try to locate it again and put our
end_of_function_label there. */
while (insn && ! (GET_CODE (insn) == JUMP_INSN
&& (GET_CODE (PATTERN (insn)) == RETURN)))
insn = PREV_INSN (insn);
if (insn)
{
insn = PREV_INSN (insn);
/* Put the label before an USE insns that may proceed the
RETURN insn. */
while (GET_CODE (insn) == USE)
insn = PREV_INSN (insn);
emit_label_after (end_of_function_label, insn);
}
else
{
/* Otherwise, make a new label and emit a RETURN and BARRIER,
if needed. */
emit_label (end_of_function_label); emit_label (end_of_function_label);
#ifdef HAVE_return #ifdef HAVE_return
if (HAVE_return) if (HAVE_return)
...@@ -392,6 +411,7 @@ find_end_label () ...@@ -392,6 +411,7 @@ find_end_label ()
} }
#endif #endif
} }
}
/* Show one additional use for this label so it won't go away until /* Show one additional use for this label so it won't go away until
we are done. */ we are done. */
...@@ -3322,7 +3342,9 @@ relax_delay_slots (first) ...@@ -3322,7 +3342,9 @@ relax_delay_slots (first)
if (label == 0) if (label == 0)
label = find_end_label (); label = find_end_label ();
if (redirect_with_delay_slots_safe_p (delay_insn, label, insn)) /* find_end_label can generate a new label. Check this first. */
if (no_labels_between_p (insn, next)
&& redirect_with_delay_slots_safe_p (delay_insn, label, insn))
{ {
/* Be careful how we do this to avoid deleting code or labels /* Be careful how we do this to avoid deleting code or labels
that are momentarily dead. See similar optimization in that are momentarily dead. See similar optimization in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment