Re: [PATCH] fold-const, gimple-fold: Some formatting cleanups

2024-06-04 Thread Richard Biener
On Tue, 4 Jun 2024, Jakub Jelinek wrote:

> Hi!
> 
> While looking into PR115337, I've spotted some badly formatted code,
> which the following patch fixes.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Looks obvious to me.

Richard.

> 2024-06-04  Jakub Jelinek  
> 
>   * fold-const.cc (tree_call_nonnegative_warnv_p): Formatting fixes.
>   (tree_invalid_nonnegative_warnv_p): Likewise.
>   * gimple-fold.cc (gimple_call_nonnegative_warnv_p): Likewise.
> 
> --- gcc/fold-const.cc.jj  2024-04-04 10:47:46.363287718 +0200
> +++ gcc/fold-const.cc 2024-06-04 10:56:57.575425348 +0200
> @@ -15331,8 +15331,8 @@ tree_call_nonnegative_warnv_p (tree type
>non-negative if both operands are non-negative.  In the presence
>of qNaNs, we're non-negative if either operand is non-negative
>and can't be a qNaN, or if both operands are non-negative.  */
> -  if (tree_expr_maybe_signaling_nan_p (arg0) ||
> -   tree_expr_maybe_signaling_nan_p (arg1))
> +  if (tree_expr_maybe_signaling_nan_p (arg0)
> +   || tree_expr_maybe_signaling_nan_p (arg1))
>  return RECURSE (arg0) && RECURSE (arg1);
>return RECURSE (arg0) ? (!tree_expr_maybe_nan_p (arg0)
>  || RECURSE (arg1))
> @@ -15431,8 +15431,8 @@ tree_invalid_nonnegative_warnv_p (tree t
>  
>  case CALL_EXPR:
>{
> - tree arg0 = call_expr_nargs (t) > 0 ?  CALL_EXPR_ARG (t, 0) : NULL_TREE;
> - tree arg1 = call_expr_nargs (t) > 1 ?  CALL_EXPR_ARG (t, 1) : NULL_TREE;
> + tree arg0 = call_expr_nargs (t) > 0 ? CALL_EXPR_ARG (t, 0) : NULL_TREE;
> + tree arg1 = call_expr_nargs (t) > 1 ? CALL_EXPR_ARG (t, 1) : NULL_TREE;
>  
>   return tree_call_nonnegative_warnv_p (TREE_TYPE (t),
> get_call_combined_fn (t),
> --- gcc/gimple-fold.cc.jj 2024-02-28 09:40:09.473563056 +0100
> +++ gcc/gimple-fold.cc2024-06-04 10:38:37.515145399 +0200
> @@ -9334,10 +9334,10 @@ static bool
>  gimple_call_nonnegative_warnv_p (gimple *stmt, bool *strict_overflow_p,
>int depth)
>  {
> -  tree arg0 = gimple_call_num_args (stmt) > 0 ?
> -gimple_call_arg (stmt, 0) : NULL_TREE;
> -  tree arg1 = gimple_call_num_args (stmt) > 1 ?
> -gimple_call_arg (stmt, 1) : NULL_TREE;
> +  tree arg0
> += gimple_call_num_args (stmt) > 0 ? gimple_call_arg (stmt, 0) : 
> NULL_TREE;
> +  tree arg1
> += gimple_call_num_args (stmt) > 1 ? gimple_call_arg (stmt, 1) : 
> NULL_TREE;
>tree lhs = gimple_call_lhs (stmt);
>return (lhs
> && tree_call_nonnegative_warnv_p (TREE_TYPE (lhs),
> 
>   Jakub
> 
> 

-- 
Richard Biener 
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)


[PATCH] fold-const, gimple-fold: Some formatting cleanups

2024-06-04 Thread Jakub Jelinek
Hi!

While looking into PR115337, I've spotted some badly formatted code,
which the following patch fixes.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2024-06-04  Jakub Jelinek  

* fold-const.cc (tree_call_nonnegative_warnv_p): Formatting fixes.
(tree_invalid_nonnegative_warnv_p): Likewise.
* gimple-fold.cc (gimple_call_nonnegative_warnv_p): Likewise.

--- gcc/fold-const.cc.jj2024-04-04 10:47:46.363287718 +0200
+++ gcc/fold-const.cc   2024-06-04 10:56:57.575425348 +0200
@@ -15331,8 +15331,8 @@ tree_call_nonnegative_warnv_p (tree type
 non-negative if both operands are non-negative.  In the presence
 of qNaNs, we're non-negative if either operand is non-negative
 and can't be a qNaN, or if both operands are non-negative.  */
-  if (tree_expr_maybe_signaling_nan_p (arg0) ||
- tree_expr_maybe_signaling_nan_p (arg1))
+  if (tree_expr_maybe_signaling_nan_p (arg0)
+ || tree_expr_maybe_signaling_nan_p (arg1))
 return RECURSE (arg0) && RECURSE (arg1);
   return RECURSE (arg0) ? (!tree_expr_maybe_nan_p (arg0)
   || RECURSE (arg1))
@@ -15431,8 +15431,8 @@ tree_invalid_nonnegative_warnv_p (tree t
 
 case CALL_EXPR:
   {
-   tree arg0 = call_expr_nargs (t) > 0 ?  CALL_EXPR_ARG (t, 0) : NULL_TREE;
-   tree arg1 = call_expr_nargs (t) > 1 ?  CALL_EXPR_ARG (t, 1) : NULL_TREE;
+   tree arg0 = call_expr_nargs (t) > 0 ? CALL_EXPR_ARG (t, 0) : NULL_TREE;
+   tree arg1 = call_expr_nargs (t) > 1 ? CALL_EXPR_ARG (t, 1) : NULL_TREE;
 
return tree_call_nonnegative_warnv_p (TREE_TYPE (t),
  get_call_combined_fn (t),
--- gcc/gimple-fold.cc.jj   2024-02-28 09:40:09.473563056 +0100
+++ gcc/gimple-fold.cc  2024-06-04 10:38:37.515145399 +0200
@@ -9334,10 +9334,10 @@ static bool
 gimple_call_nonnegative_warnv_p (gimple *stmt, bool *strict_overflow_p,
 int depth)
 {
-  tree arg0 = gimple_call_num_args (stmt) > 0 ?
-gimple_call_arg (stmt, 0) : NULL_TREE;
-  tree arg1 = gimple_call_num_args (stmt) > 1 ?
-gimple_call_arg (stmt, 1) : NULL_TREE;
+  tree arg0
+= gimple_call_num_args (stmt) > 0 ? gimple_call_arg (stmt, 0) : NULL_TREE;
+  tree arg1
+= gimple_call_num_args (stmt) > 1 ? gimple_call_arg (stmt, 1) : NULL_TREE;
   tree lhs = gimple_call_lhs (stmt);
   return (lhs
  && tree_call_nonnegative_warnv_p (TREE_TYPE (lhs),

Jakub