http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58615
Bug ID: 58615 Summary: [SH] Optimize simple function returns Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: olegendo at gcc dot gnu.org Target: sh*-*-* As of rev. 202876, the file linux-2.4.23-pre3-testplatform/net/ipv4/igmp.c from the CSiBE set, compiled with -m4-single -ml -O2 -mpretend-cmove shows the following sequence: .type _is_in, @function _is_in: ... .L3: ... tst r1,r1 negc r0,r3 .align 2 .L29: rts mov r3,r0 .L8: ... movt r0 bra .L29 xor r0,r3 .L9: ... tst r7,r7 bra .L29 movt r3 .L6: ... tst r1,r1 bra .L29 negc r0,r3 .L7: ... cmp/eq r2,r1 bra .L29 movt r3 .L31: ... tst r1,r1 bra .L29 negc r0,r3 In cases where the prologue is trivial or consists of only a few instructions, it would be better to return from the function directly, instead of branching to the returning basic block.