From patchwork Thu Nov 18 23:37:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: PATCH: Properly check the end of basic block Date: Thu, 18 Nov 2010 13:37:42 -0000 From: Uros Bizjak X-Patchwork-Id: 72170 Message-Id: To: Richard Henderson Cc: "H.J. Lu" , gcc-patches@gcc.gnu.org, Jan Hubicka On Fri, Nov 19, 2010 at 12:09 AM, Richard Henderson wrote: > On 11/18/2010 02:50 PM, Uros Bizjak wrote: >> -       emit_jump_insn_before (gen_return_internal_long (), ret); >> +       /* We have to update BB_END (bb) here - delete_insn will >> +          not do it automatically since CFG is not available in >> +          machine_reorg pass.  */ >> +       BB_END (bb) >> +         = emit_jump_insn_before (gen_return_internal_long (), ret); > > While that by itself is fine, calling compute_bb_for_insn at the > beginning of md_reorg will make sure that things stay up-to-date > for any other changes that are being made within that function. > > I.e. compute_bb_for_insn seems safer overall. Thanks, attached patch adds x86 as a 10th member to an unhappy family of targets that are crippled by a compatibility requirements... 2010-11-19 Uros Bizjak PR target/46546 * config/i386/i386.c (ix86_reorg): Call compute_bb_for_insn. Bootstrapped on x86_64-pc-linux-gnu {,32}, will commit to mainline once regression test ends. Uros. Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 166920) +++ config/i386/i386.c (working copy) @@ -29765,6 +29765,10 @@ ix86_pad_short_function (void) static void ix86_reorg (void) { + /* We are freeing block_for_insn in the toplev to keep compatibility + with old MDEP_REORGS that are not CFG based. Recompute it now. */ + compute_bb_for_insn (); + if (optimize && optimize_function_for_speed_p (cfun)) { if (TARGET_PAD_SHORT_FUNCTION)