[#1/7] allow vuses in ifcombine blocks (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

Message ID orwmhwv1u6.fsf_-_@lxoliva.fsfla.org
State Committed
Commit 8e6a25b01becf449d54154b7e83de5f4955cba37
Headers
Series [#1/7] allow vuses in ifcombine blocks (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine) |

Commit Message

Alexandre Oliva Oct. 25, 2024, 11:50 a.m. UTC
  Disallowing vuses in blocks for ifcombine is too strict, and it
prevents usefully moving fold_truth_andor into ifcombine.  That
tree-level folder has long ifcombined loads, absent other relevant
side effects.


for  gcc/ChangeLog

	* tree-ssa-ifcombine.c (bb_no_side_effects_p): Allow vuses,
	but not vdefs.
---
 gcc/tree-ssa-ifcombine.cc |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Jeff Law Oct. 27, 2024, 7:54 p.m. UTC | #1
On 10/25/24 5:50 AM, Alexandre Oliva wrote:
> 
> Disallowing vuses in blocks for ifcombine is too strict, and it
> prevents usefully moving fold_truth_andor into ifcombine.  That
> tree-level folder has long ifcombined loads, absent other relevant
> side effects.
> 
> 
> for  gcc/ChangeLog
> 
> 	* tree-ssa-ifcombine.c (bb_no_side_effects_p): Allow vuses,
> 	but not vdefs.
OK
jeff
  
Richard Biener Oct. 30, 2024, 1:50 p.m. UTC | #2
On Fri, Oct 25, 2024 at 4:39 PM Alexandre Oliva <oliva@adacore.com> wrote:
>
>
> Disallowing vuses in blocks for ifcombine is too strict, and it
> prevents usefully moving fold_truth_andor into ifcombine.  That
> tree-level folder has long ifcombined loads, absent other relevant
> side effects.

OK.

Richard.

>
> for  gcc/ChangeLog
>
>         * tree-ssa-ifcombine.c (bb_no_side_effects_p): Allow vuses,
>         but not vdefs.
> ---
>  gcc/tree-ssa-ifcombine.cc |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc
> index 6a3bc99190d9e..ed20a231951a3 100644
> --- a/gcc/tree-ssa-ifcombine.cc
> +++ b/gcc/tree-ssa-ifcombine.cc
> @@ -129,7 +129,7 @@ bb_no_side_effects_p (basic_block bb)
>        enum tree_code rhs_code;
>        if (gimple_has_side_effects (stmt)
>           || gimple_could_trap_p (stmt)
> -         || gimple_vuse (stmt)
> +         || gimple_vdef (stmt)
>           /* We need to rewrite stmts with undefined overflow to use
>              unsigned arithmetic but cannot do so for signed division.  */
>           || ((ass = dyn_cast <gassign *> (stmt))
>
>
> --
> Alexandre Oliva, happy hacker            https://FSFLA.org/blogs/lxo/
>    Free Software Activist                   GNU Toolchain Engineer
> More tolerance and less prejudice are key for inclusion and diversity
> Excluding neuro-others for not behaving ""normal"" is *not* inclusive
  

Patch

diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc
index 6a3bc99190d9e..ed20a231951a3 100644
--- a/gcc/tree-ssa-ifcombine.cc
+++ b/gcc/tree-ssa-ifcombine.cc
@@ -129,7 +129,7 @@  bb_no_side_effects_p (basic_block bb)
       enum tree_code rhs_code;
       if (gimple_has_side_effects (stmt)
 	  || gimple_could_trap_p (stmt)
-	  || gimple_vuse (stmt)
+	  || gimple_vdef (stmt)
 	  /* We need to rewrite stmts with undefined overflow to use
 	     unsigned arithmetic but cannot do so for signed division.  */
 	  || ((ass = dyn_cast <gassign *> (stmt))