[#2/7] drop redundant ifcombine_ifandif parm (was: Re: [PATCH] fold fold_truth_andor field merging into ifcombine)

Message ID orseskv1sd.fsf_-_@lxoliva.fsfla.org
State Committed
Commit 77c925464e50dfdf224be3c27e5b72de21a92e86
Headers
Series fold fold_truth_andor field merging into ifcombine was: [PATCH] assorted improvements for fold_truth_andor_1) |

Commit Message

Alexandre Oliva Oct. 25, 2024, 11:51 a.m. UTC
  In preparation to changes that may modify both inner and outer
conditions in ifcombine, drop the redundant parameter result_inv, that
is always identical to inner_inv.


for  gcc/ChangeLog

	* tree-ssa-ifcombine.cc (ifcombine_ifandif): Drop redundant
	result_inv parm.  Adjust all callers.
---
 gcc/tree-ssa-ifcombine.cc |   18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)
  

Comments

Jeff Law Oct. 27, 2024, 7:55 p.m. UTC | #1
On 10/25/24 5:51 AM, Alexandre Oliva wrote:
> 
> In preparation to changes that may modify both inner and outer
> conditions in ifcombine, drop the redundant parameter result_inv, that
> is always identical to inner_inv.
> 
> 
> for  gcc/ChangeLog
> 
> 	* tree-ssa-ifcombine.cc (ifcombine_ifandif): Drop redundant
> 	result_inv parm.  Adjust all callers.
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:
>
>
> In preparation to changes that may modify both inner and outer
> conditions in ifcombine, drop the redundant parameter result_inv, that
> is always identical to inner_inv.

OK.

>
> for  gcc/ChangeLog
>
>         * tree-ssa-ifcombine.cc (ifcombine_ifandif): Drop redundant
>         result_inv parm.  Adjust all callers.
> ---
>  gcc/tree-ssa-ifcombine.cc |   18 +++++++-----------
>  1 file changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc
> index ed20a231951a3..0a2ba970548c8 100644
> --- a/gcc/tree-ssa-ifcombine.cc
> +++ b/gcc/tree-ssa-ifcombine.cc
> @@ -401,14 +401,14 @@ update_profile_after_ifcombine (basic_block inner_cond_bb,
>
>  /* If-convert on a and pattern with a common else block.  The inner
>     if is specified by its INNER_COND_BB, the outer by OUTER_COND_BB.
> -   inner_inv, outer_inv and result_inv indicate whether the conditions
> -   are inverted.
> +   inner_inv, outer_inv indicate whether the conditions are inverted.
>     Returns true if the edges to the common else basic-block were merged.  */
>
>  static bool
>  ifcombine_ifandif (basic_block inner_cond_bb, bool inner_inv,
> -                  basic_block outer_cond_bb, bool outer_inv, bool result_inv)
> +                  basic_block outer_cond_bb, bool outer_inv)
>  {
> +  bool result_inv = inner_inv;
>    gimple_stmt_iterator gsi;
>    tree name1, name2, bit1, bit2, bits1, bits2;
>
> @@ -693,8 +693,7 @@ tree_ssa_ifcombine_bb_1 (basic_block inner_cond_bb, basic_block outer_cond_bb,
>            <else_bb>
>              ...
>         */
> -      return ifcombine_ifandif (inner_cond_bb, false, outer_cond_bb, false,
> -                               false);
> +      return ifcombine_ifandif (inner_cond_bb, false, outer_cond_bb, false);
>      }
>
>    /* And a version where the outer condition is negated.  */
> @@ -711,8 +710,7 @@ tree_ssa_ifcombine_bb_1 (basic_block inner_cond_bb, basic_block outer_cond_bb,
>            <else_bb>
>              ...
>         */
> -      return ifcombine_ifandif (inner_cond_bb, false, outer_cond_bb, true,
> -                               false);
> +      return ifcombine_ifandif (inner_cond_bb, false, outer_cond_bb, true);
>      }
>
>    /* The || form is characterized by a common then_bb with the
> @@ -731,8 +729,7 @@ tree_ssa_ifcombine_bb_1 (basic_block inner_cond_bb, basic_block outer_cond_bb,
>            <then_bb>
>              ...
>         */
> -      return ifcombine_ifandif (inner_cond_bb, true, outer_cond_bb, true,
> -                               true);
> +      return ifcombine_ifandif (inner_cond_bb, true, outer_cond_bb, true);
>      }
>
>    /* And a version where the outer condition is negated.  */
> @@ -748,8 +745,7 @@ tree_ssa_ifcombine_bb_1 (basic_block inner_cond_bb, basic_block outer_cond_bb,
>            <then_bb>
>              ...
>         */
> -      return ifcombine_ifandif (inner_cond_bb, true, outer_cond_bb, false,
> -                               true);
> +      return ifcombine_ifandif (inner_cond_bb, true, outer_cond_bb, false);
>      }
>
>    return false;
>
>
> --
> 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 ed20a231951a3..0a2ba970548c8 100644
--- a/gcc/tree-ssa-ifcombine.cc
+++ b/gcc/tree-ssa-ifcombine.cc
@@ -401,14 +401,14 @@  update_profile_after_ifcombine (basic_block inner_cond_bb,
 
 /* If-convert on a and pattern with a common else block.  The inner
    if is specified by its INNER_COND_BB, the outer by OUTER_COND_BB.
-   inner_inv, outer_inv and result_inv indicate whether the conditions
-   are inverted.
+   inner_inv, outer_inv indicate whether the conditions are inverted.
    Returns true if the edges to the common else basic-block were merged.  */
 
 static bool
 ifcombine_ifandif (basic_block inner_cond_bb, bool inner_inv,
-		   basic_block outer_cond_bb, bool outer_inv, bool result_inv)
+		   basic_block outer_cond_bb, bool outer_inv)
 {
+  bool result_inv = inner_inv;
   gimple_stmt_iterator gsi;
   tree name1, name2, bit1, bit2, bits1, bits2;
 
@@ -693,8 +693,7 @@  tree_ssa_ifcombine_bb_1 (basic_block inner_cond_bb, basic_block outer_cond_bb,
 	   <else_bb>
 	     ...
        */
-      return ifcombine_ifandif (inner_cond_bb, false, outer_cond_bb, false,
-				false);
+      return ifcombine_ifandif (inner_cond_bb, false, outer_cond_bb, false);
     }
 
   /* And a version where the outer condition is negated.  */
@@ -711,8 +710,7 @@  tree_ssa_ifcombine_bb_1 (basic_block inner_cond_bb, basic_block outer_cond_bb,
 	   <else_bb>
 	     ...
        */
-      return ifcombine_ifandif (inner_cond_bb, false, outer_cond_bb, true,
-				false);
+      return ifcombine_ifandif (inner_cond_bb, false, outer_cond_bb, true);
     }
 
   /* The || form is characterized by a common then_bb with the
@@ -731,8 +729,7 @@  tree_ssa_ifcombine_bb_1 (basic_block inner_cond_bb, basic_block outer_cond_bb,
 	   <then_bb>
 	     ...
        */
-      return ifcombine_ifandif (inner_cond_bb, true, outer_cond_bb, true,
-				true);
+      return ifcombine_ifandif (inner_cond_bb, true, outer_cond_bb, true);
     }
 
   /* And a version where the outer condition is negated.  */
@@ -748,8 +745,7 @@  tree_ssa_ifcombine_bb_1 (basic_block inner_cond_bb, basic_block outer_cond_bb,
 	   <then_bb>
 	     ...
        */
-      return ifcombine_ifandif (inner_cond_bb, true, outer_cond_bb, false,
-				true);
+      return ifcombine_ifandif (inner_cond_bb, true, outer_cond_bb, false);
     }
 
   return false;