diff mbox series

[3/6] PHIOPT: Allow other diamond uses when do_hoist_loads is true

Message ID 20230422220921.452264-4-apinski@marvell.com
State New
Headers show
Series Improve PHIOPT match and simplify for diamond shaped bbs | expand

Commit Message

Andrew Pinski April 22, 2023, 10:09 p.m. UTC
While working on adding diamond shaped form to match-and-simplify
phiopt, I Noticed that we would not reach there if do_hoist_loads
was true. In the original code before the cleanups it was not
obvious why but after I finished the cleanups, it was just a matter
of removing a continue and that is what this patch does.

This just happens also to fix a bug report that I noticed too.

OK? Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

	PR tree-optimize/68894
	* tree-ssa-phiopt.cc (tree_ssa_phiopt_worker): Remove the
	continue for the do_hoist_loads diamond case.
---
 gcc/tree-ssa-phiopt.cc | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Richard Biener April 24, 2023, 12:06 p.m. UTC | #1
On Sun, Apr 23, 2023 at 12:13 AM Andrew Pinski via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> While working on adding diamond shaped form to match-and-simplify
> phiopt, I Noticed that we would not reach there if do_hoist_loads
> was true. In the original code before the cleanups it was not
> obvious why but after I finished the cleanups, it was just a matter
> of removing a continue and that is what this patch does.
>
> This just happens also to fix a bug report that I noticed too.
>
> OK? Bootstrapped and tested on x86_64-linux-gnu.

OK.

> gcc/ChangeLog:
>
>         PR tree-optimize/68894
>         * tree-ssa-phiopt.cc (tree_ssa_phiopt_worker): Remove the
>         continue for the do_hoist_loads diamond case.
> ---
>  gcc/tree-ssa-phiopt.cc | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
> index 05f19825ce9..e4062f33efa 100644
> --- a/gcc/tree-ssa-phiopt.cc
> +++ b/gcc/tree-ssa-phiopt.cc
> @@ -243,10 +243,7 @@ tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads, bool early_p)
>                  is likely to perform worse than the well-predicted branch.  */
>               && !predictable_edge_p (EDGE_SUCC (bb, 0))
>               && !predictable_edge_p (EDGE_SUCC (bb, 1)))
> -           {
> -             hoist_adjacent_loads (bb, bb1, bb2, bb3);
> -             continue;
> -           }
> +           hoist_adjacent_loads (bb, bb1, bb2, bb3);
>         }
>
>        gimple_stmt_iterator gsi;
> --
> 2.39.1
>
diff mbox series

Patch

diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
index 05f19825ce9..e4062f33efa 100644
--- a/gcc/tree-ssa-phiopt.cc
+++ b/gcc/tree-ssa-phiopt.cc
@@ -243,10 +243,7 @@  tree_ssa_phiopt_worker (bool do_store_elim, bool do_hoist_loads, bool early_p)
 		 is likely to perform worse than the well-predicted branch.  */
 	      && !predictable_edge_p (EDGE_SUCC (bb, 0))
 	      && !predictable_edge_p (EDGE_SUCC (bb, 1)))
-	    {
-	      hoist_adjacent_loads (bb, bb1, bb2, bb3);
-	      continue;
-	    }
+	    hoist_adjacent_loads (bb, bb1, bb2, bb3);
 	}
 
       gimple_stmt_iterator gsi;