diff mbox series

tree-optimization/103551 - Always set EDGE_EXECUTABLE in ranger vrp.

Message ID 5d69d8fd-03c0-07e2-1031-41ed502fcee0@redhat.com
State New
Headers show
Series tree-optimization/103551 - Always set EDGE_EXECUTABLE in ranger vrp. | expand

Commit Message

Andrew MacLeod Jan. 11, 2022, 7:48 p.m. UTC
The simplify_and_fold engine uses the EDGE_EXECUTABLE flag to eliminate 
branches:

substitute_and_fold_dom_walker::before_dom_children:

      if (gimple_code (stmt) == GIMPLE_COND)
         {
           if ((EDGE_SUCC (bb, 0)->flags & EDGE_EXECUTABLE)
               ^ (EDGE_SUCC (bb, 1)->flags & EDGE_EXECUTABLE))

... but if certain passes before VRP2 are turned off, the flag can be in 
an uninitialized state upon entry to VRP2.  This patch simply always 
sets EDGE_EXECUTABLE on all edges before invoking ranger and the S&F engine.

Bootstraps on  x86_64-pc-linux-gnu with no regressions.

OK for trunk?

Andrew

Comments

Richard Biener Jan. 12, 2022, 9:02 a.m. UTC | #1
On Tue, Jan 11, 2022 at 8:49 PM Andrew MacLeod via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> The simplify_and_fold engine uses the EDGE_EXECUTABLE flag to eliminate
> branches:
>
> substitute_and_fold_dom_walker::before_dom_children:
>
>       if (gimple_code (stmt) == GIMPLE_COND)
>          {
>            if ((EDGE_SUCC (bb, 0)->flags & EDGE_EXECUTABLE)
>                ^ (EDGE_SUCC (bb, 1)->flags & EDGE_EXECUTABLE))
>
> ... but if certain passes before VRP2 are turned off, the flag can be in
> an uninitialized state upon entry to VRP2.  This patch simply always
> sets EDGE_EXECUTABLE on all edges before invoking ranger and the S&F engine.
>
> Bootstraps on  x86_64-pc-linux-gnu with no regressions.
>
> OK for trunk?

OK.

> Andrew
>
>
>
>
>
diff mbox series

Patch

commit 09934a28871701f3cef5175c2a510cd09ec13836
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Tue Jan 11 09:59:21 2022 -0500

    Always set EDGE_EXECUTABLE in VRP2.
    
            PR tree-optimization/103551
            * tree-vrp.c (execute_ranger_vrp): Always set EDGE_EXECUTABLE.

diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 804f3171ccc..62946450b13 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -4332,6 +4332,7 @@  execute_ranger_vrp (struct function *fun, bool warn_array_bounds_p)
   scev_initialize ();
   calculate_dominance_info (CDI_DOMINATORS);
 
+  set_all_edges_as_executable (fun);
   gimple_ranger *ranger = enable_ranger (fun);
   rvrp_folder folder (ranger);
   folder.substitute_and_fold ();