On Mon, Aug 25, 2025 at 2:49 AM Andrew Pinski
<andrew.pin...@oss.qualcomm.com> wrote:
>
> After changing the return type of remove_prop_source_from_use,
> forward_propagate_into_comparison will never return 2. So boolify
> forward_propagate_into_comparison.
>
> Bootstrapped and tested on x86_64-linux-gnu.

OK.

> gcc/ChangeLog:
>
>         * tree-ssa-forwprop.cc (forward_propagate_into_comparison): Boolify.
>         (pass_forwprop::execute): Don't handle return of 2 from
>         forward_propagate_into_comparison.
>
> Signed-off-by: Andrew Pinski <andrew.pin...@oss.qualcomm.com>
> ---
>  gcc/tree-ssa-forwprop.cc | 17 +++++------------
>  1 file changed, 5 insertions(+), 12 deletions(-)
>
> diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc
> index 1e30efb18d1..5aed2967731 100644
> --- a/gcc/tree-ssa-forwprop.cc
> +++ b/gcc/tree-ssa-forwprop.cc
> @@ -500,10 +500,9 @@ forward_propagate_into_comparison_1 (gimple *stmt,
>
>  /* Propagate from the ssa name definition statements of the assignment
>     from a comparison at *GSI into the conditional if that simplifies it.
> -   Returns 1 if the stmt was modified and 2 if the CFG needs cleanup,
> -   otherwise returns 0.  */
> +   Returns true if the stmt was modified.  */
>
> -static int
> +static bool
>  forward_propagate_into_comparison (gimple_stmt_iterator *gsi)
>  {
>    gimple *stmt = gsi_stmt (*gsi);
> @@ -534,10 +533,10 @@ forward_propagate_into_comparison (gimple_stmt_iterator 
> *gsi)
>         remove_prop_source_from_use (rhs1);
>        if (TREE_CODE (rhs2) == SSA_NAME)
>         remove_prop_source_from_use (rhs2);
> -      return 1;
> +      return true;
>      }
>
> -  return 0;
> +  return false;
>  }
>
>  /* Propagate from the ssa name definition statements of COND_EXPR
> @@ -5139,13 +5138,7 @@ pass_forwprop::execute (function *fun)
>                       }
>
>                     if (TREE_CODE_CLASS (code) == tcc_comparison)
> -                     {
> -                       int did_something;
> -                       did_something = forward_propagate_into_comparison 
> (&gsi);
> -                       if (did_something == 2)
> -                         cfg_changed = true;
> -                       changed |= did_something != 0;
> -                     }
> +                     changed |= forward_propagate_into_comparison (&gsi);
>                     else if ((code == PLUS_EXPR
>                               || code == BIT_IOR_EXPR
>                               || code == BIT_XOR_EXPR)
> --
> 2.43.0
>

Reply via email to