[backport from gcc-4.9/trunk r197036 ] List-Archive: From: Eric Botcazou Subject: Fix bug with simple returns on cc0 targets Date: Mon, 25 Mar 2013 12:24:15 +0100 Hi, for a private port which both is a cc0 target and has conditional returns, emit_use_return_register_into_block will try to emit the use return register sequence between a cc0 setter and a cc0 user. Fixed thusly, tested on x86_64-suse-linux, applied on the mainline. gcc/ 2013-03-25 Eric Botcazou * function.c (emit_use_return_register_into_block): On cc0 targets, do not emit the sequence between cc0 setter and user. --- gcc-4.8.0/gcc/function.c.~1~ 2013-03-09 08:54:02.000000000 +0100 +++ gcc-4.8.0/gcc/function.c 2013-03-29 14:03:35.822981791 +0100 @@ -5597,12 +5597,17 @@ prepare_shrink_wrap (basic_block entry_b static void emit_use_return_register_into_block (basic_block bb) { - rtx seq; + rtx seq, insn; start_sequence (); use_return_register (); seq = get_insns (); end_sequence (); - emit_insn_before (seq, BB_END (bb)); + insn = BB_END (bb); +#ifdef HAVE_cc0 + if (reg_mentioned_p (cc0_rtx, PATTERN (insn))) + insn = prev_cc0_setter (insn); +#endif + emit_insn_before (seq, insn); }