This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] m68k: Correctly emit a return insn.
- From: Kazu Hirata <kazu at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: law at redhat dot com, schwab at suse dot de
- Date: Mon, 18 Jun 2007 06:58:51 -0700
- Subject: [patch] m68k: Correctly emit a return insn.
Hi,
Attached is a patch to correctly emit a return insn.
I've noticed that
void foo (void) {}
is compiled into
foo:
link.w %fp,#0
unlk %fp
with -O2 without "rts" at the end.
This is because the RTL DCE pass thinks that the "(return)" insn is
unused because the insn is mistakenly a NONJUMP_INSN. This patch
fixes the problem by emitting the "(return)" insn as a JUMP_INSN.
Tested by running "Hello, world". Committed as obvious.
Kazu Hirata
2007-06-18 Kazu Hirata <kazu@codesourcery.com>
* config/m68k/m68k.c (m68k_expand_epilogue): Emit a return
insn with emit_jump_insn.
Index: gcc/config/m68k/m68k.c
===================================================================
--- gcc/config/m68k/m68k.c (revision 125788)
+++ gcc/config/m68k/m68k.c (working copy)
@@ -1214,7 +1214,7 @@ m68k_expand_epilogue (bool sibcall_p)
EH_RETURN_STACKADJ_RTX));
if (!sibcall_p)
- emit_insn (gen_rtx_RETURN (VOIDmode));
+ emit_jump_insn (gen_rtx_RETURN (VOIDmode));
}
/* Return true if X is a valid comparison operator for the dbcc