Patchwork Remove useless sets/clears of EDGE_CAN_FALLTHRU

login
register
mail settings
Submitter Steven Bosscher
Date July 14, 2012, 9:40 p.m.
Message ID <CABu31nN0TzsbGh7Ygr7QhDsgx9OvmOn0_Ot6TwEN-m5xNEN7DQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/171028/
State New
Headers show

Comments

Steven Bosscher - July 14, 2012, 9:40 p.m.
Hello,

EDGE_CAN_FALLTHRU is internal to bb-reorder.c,
set_edge_can_fallthru_flag() clears it on all edges and computes it
fresh for bb-reorder.

The test in rtl_verify_flow_info_1 has to stay because bb-reorder
doesn't clean up the flag after it's done.

Bootstrapped&tested on powerpc64-unknown-linux-gnu. OK?

Ciao!
Steven

        * haifa-sched.c (init_before_recovery): Do not set EDGE_CAN_FALLTHRU.
        * cfgrtl.c (force_nonfallthru_and_redirect): Likewise.
Richard Guenther - July 16, 2012, 8:53 a.m.
On Sat, Jul 14, 2012 at 11:40 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> Hello,
>
> EDGE_CAN_FALLTHRU is internal to bb-reorder.c,
> set_edge_can_fallthru_flag() clears it on all edges and computes it
> fresh for bb-reorder.
>
> The test in rtl_verify_flow_info_1 has to stay because bb-reorder
> doesn't clean up the flag after it's done.
>
> Bootstrapped&tested on powerpc64-unknown-linux-gnu. OK?

Ok.

Maybe we should rename EDGE_CAN_FALLTHRU to EDGE_PLF_1
and have a #define in bb-reorder.c then?  Other passes might use
it for their pass-local handling then and would not be content to set/unset
it.

Thanks,
Richard.

> Ciao!
> Steven
>
>         * haifa-sched.c (init_before_recovery): Do not set EDGE_CAN_FALLTHRU.
>         * cfgrtl.c (force_nonfallthru_and_redirect): Likewise.
>
> Index: haifa-sched.c
> ===================================================================
> --- haifa-sched.c       (revision 189478)
> +++ haifa-sched.c       (working copy)
> @@ -7193,8 +7193,7 @@ init_before_recovery (basic_block *before_recovery
>
>        redirect_edge_succ (e, single);
>        make_single_succ_edge (single, empty, 0);
> -      make_single_succ_edge (empty, EXIT_BLOCK_PTR,
> -                            EDGE_FALLTHRU | EDGE_CAN_FALLTHRU);
> +      make_single_succ_edge (empty, EXIT_BLOCK_PTR, EDGE_FALLTHRU);
>
>        label = block_label (empty);
>        x = emit_jump_insn_after (gen_jump (label), BB_END (single));
> Index: cfgrtl.c
> ===================================================================
> --- cfgrtl.c    (revision 189478)
> +++ cfgrtl.c    (working copy)
> @@ -1365,8 +1365,8 @@ force_nonfallthru_and_redirect (edge e, basic_bloc
>          one and create separate abnormal edge to original destination.
>          This allows bb-reorder to make such edge non-fallthru.  */
>        gcc_assert (e->dest == target);
> -      abnormal_edge_flags = e->flags & ~(EDGE_FALLTHRU | EDGE_CAN_FALLTHRU);
> -      e->flags &= EDGE_FALLTHRU | EDGE_CAN_FALLTHRU;
> +      abnormal_edge_flags = e->flags & ~EDGE_FALLTHRU;
> +      e->flags &= EDGE_FALLTHRU;
>      }
>    else
>      {
Steven Bosscher - July 16, 2012, 9:03 a.m.
On Mon, Jul 16, 2012 at 10:53 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> Maybe we should rename EDGE_CAN_FALLTHRU to EDGE_PLF_1
> and have a #define in bb-reorder.c then?  Other passes might use
> it for their pass-local handling then and would not be content to set/unset
> it.

I intend to do a lot more cleanups on the edge and basic block flags
(that depends on the dumpfile.h patch, eagerly awaiting your ACK or
comments ;-).

For EDGE_CAN_FALLTHRU I was more thinking of a pointer map or an
sbitmap on an edge list, tbd. Or, like you suggest, make it a flag
available for passes to use. That would also help for a few other
flags (EDGE_LOOP_EXIT, EDGE_EXECUTABLE, ...).

Ciao!
Steven
Richard Guenther - July 16, 2012, 9:30 a.m.
On Mon, Jul 16, 2012 at 11:03 AM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> On Mon, Jul 16, 2012 at 10:53 AM, Richard Guenther
> <richard.guenther@gmail.com> wrote:
>> Maybe we should rename EDGE_CAN_FALLTHRU to EDGE_PLF_1
>> and have a #define in bb-reorder.c then?  Other passes might use
>> it for their pass-local handling then and would not be content to set/unset
>> it.
>
> I intend to do a lot more cleanups on the edge and basic block flags
> (that depends on the dumpfile.h patch, eagerly awaiting your ACK or
> comments ;-).

See your inbox ;)

> For EDGE_CAN_FALLTHRU I was more thinking of a pointer map or an
> sbitmap on an edge list, tbd. Or, like you suggest, make it a flag
> available for passes to use. That would also help for a few other
> flags (EDGE_LOOP_EXIT, EDGE_EXECUTABLE, ...).

Indeed - I prefer the pass-specific flags approach, we seem to have this
almost everywhere.

Richard.

> Ciao!
> Steven

Patch

Index: haifa-sched.c
===================================================================
--- haifa-sched.c       (revision 189478)
+++ haifa-sched.c       (working copy)
@@ -7193,8 +7193,7 @@  init_before_recovery (basic_block *before_recovery

       redirect_edge_succ (e, single);
       make_single_succ_edge (single, empty, 0);
-      make_single_succ_edge (empty, EXIT_BLOCK_PTR,
-                            EDGE_FALLTHRU | EDGE_CAN_FALLTHRU);
+      make_single_succ_edge (empty, EXIT_BLOCK_PTR, EDGE_FALLTHRU);

       label = block_label (empty);
       x = emit_jump_insn_after (gen_jump (label), BB_END (single));
Index: cfgrtl.c
===================================================================
--- cfgrtl.c    (revision 189478)
+++ cfgrtl.c    (working copy)
@@ -1365,8 +1365,8 @@  force_nonfallthru_and_redirect (edge e, basic_bloc
         one and create separate abnormal edge to original destination.
         This allows bb-reorder to make such edge non-fallthru.  */
       gcc_assert (e->dest == target);
-      abnormal_edge_flags = e->flags & ~(EDGE_FALLTHRU | EDGE_CAN_FALLTHRU);
-      e->flags &= EDGE_FALLTHRU | EDGE_CAN_FALLTHRU;
+      abnormal_edge_flags = e->flags & ~EDGE_FALLTHRU;
+      e->flags &= EDGE_FALLTHRU;
     }
   else
     {