Patchwork Fix PR 53743 and other -freorder-blocks-and-partition failures (issue6823047)

login
register
mail settings
Submitter Steven Bosscher
Date Oct. 30, 2012, 6:53 p.m.
Message ID <CABu31nMjtSNEW-1nGtg_77BDHHS7Wi-zzkfy6nX5Fux3q1kSwg@mail.gmail.com>
Download mbox | patch
Permalink /patch/195602/
State New
Headers show

Comments

Steven Bosscher - Oct. 30, 2012, 6:53 p.m.
On Tue, Oct 30, 2012 at 6:48 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> On Tue, Oct 30, 2012 at 6:20 AM, Teresa Johnson wrote:
>> Index: bb-reorder.c
>> ===================================================================
>> --- bb-reorder.c        (revision 192692)
>> +++ bb-reorder.c        (working copy)
>> @@ -2188,6 +2188,8 @@ insert_section_boundary_note (void)
>>         first_partition = BB_PARTITION (bb);
>>        if (BB_PARTITION (bb) != first_partition)
>>         {
>> +          /* There should be a barrier between text sections. */
>> +          emit_barrier_after (BB_END (bb->prev_bb));
>
> So why isn't there one? There can't be a fall-through edge from one
> section to the other, so cfgrtl.c:fixup_reorder_chain should have
> added a barrier here already in the code under the comment:
>
>   /* Now add jumps and labels as needed to match the blocks new
>      outgoing edges.  */
>
> Why isn't it doing that for you?

Maybe it's because fix_up_fall_thru_edges calls force_nonfallthru,
which is incorrectly inserting JUMP_INSNs and BARRIERs in cfglayout
mode. I'm going to test this patch:
Steven Bosscher - Oct. 30, 2012, 9:28 p.m.
Hello Teresa,

Could you try this patch for me also? It moves bbpart outside the part
of the passes pipeline that works in cfglayout mode.

Patch

Index: cfgrtl.c
===================================================================
--- cfgrtl.c    (revision 192889)
+++ cfgrtl.c    (working copy)
@@ -1511,16 +1511,17 @@  force_nonfallthru_and_redirect (edge e,
 #endif
        }
       set_return_jump_label (BB_END (jump_block));
+      emit_barrier_after (BB_END (jump_block));
     }
-  else
+  else if (current_ir_type () == IR_RTL_CFGRTL)
     {
       rtx label = block_label (target);
       emit_jump_insn_after_setloc (gen_jump (label), BB_END (jump_block), loc);
       JUMP_LABEL (BB_END (jump_block)) = label;
       LABEL_NUSES (label)++;
+      emit_barrier_after (BB_END (jump_block));
     }

-  emit_barrier_after (BB_END (jump_block));
   redirect_edge_succ_nodup (e, target);

   if (abnormal_edge_flags)