[PATCH] Fix PR 53743 and other -freorder-blocks-and-partition failures (issue6823047)

Steven Bosscher stevenb.gcc@gmail.com
Tue Oct 30 19:02:00 GMT 2012


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:

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)



More information about the Gcc-patches mailing list