Patchwork PATCH: Properly check the end of basic block

login
register
mail settings
Submitter Uros Bizjak
Date Nov. 18, 2010, 11:37 p.m.
Message ID <AANLkTi=dds4BLXzFxZKXH2BBQzyJhBX4nnGKa55qoNcz@mail.gmail.com>
Download mbox | patch
Permalink /patch/72170/
State New
Headers show

Comments

Uros Bizjak - Nov. 18, 2010, 11:37 p.m.
On Fri, Nov 19, 2010 at 12:09 AM, Richard Henderson <rth@redhat.com> 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  <ubizjak@gmail.com>

	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.

Patch

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)