public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-5268] niter: Fix up unused var warning [PR108457]
Date: Fri, 20 Jan 2023 09:24:27 +0000 (GMT)	[thread overview]
Message-ID: <20230120092427.E879438582BC@sourceware.org> (raw)

https://gcc.gnu.org/g:16bd9e14f226e07bf0ffb9d68084c9ad69bf7b45

commit r13-5268-g16bd9e14f226e07bf0ffb9d68084c9ad69bf7b45
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Jan 20 10:23:49 2023 +0100

    niter: Fix up unused var warning [PR108457]
    
    tree-ssa-loop-niter.cc (build_cltz_expr) gets unused variable mode
    warning on some architectures where C[LT]Z_DEFINED_VALUE_AT_ZERO
    macro(s) don't use the first argument (which includes the
    defaults.h definitions of:
     #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE)  0
     #define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE)  0
    Other uses of this macro avoid this problem by avoiding temporaries
    which are only used as argument to those macros, the following patch
    does it the same way for consistency.  Plus some formatting fixes
    while at it.
    
    2023-01-20  Jakub Jelinek  <jakub@redhat.com>
    
            PR tree-optimization/108457
            * tree-ssa-loop-niter.cc (build_cltz_expr): Use
            SCALAR_INT_TYPE_MODE (utype) directly as C[LT]Z_DEFINED_VALUE_AT_ZERO
            argument instead of a temporary.  Formatting fixes.

Diff:
---
 gcc/tree-ssa-loop-niter.cc | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/gcc/tree-ssa-loop-niter.cc b/gcc/tree-ssa-loop-niter.cc
index 65b960461ae..581bf5d067b 100644
--- a/gcc/tree-ssa-loop-niter.cc
+++ b/gcc/tree-ssa-loop-niter.cc
@@ -2252,16 +2252,16 @@ build_cltz_expr (tree src, bool leading, bool define_at_zero)
       call = build_call_expr_internal_loc (UNKNOWN_LOCATION, ifn,
 					   integer_type_node, 1, src);
       int val;
-      scalar_int_mode mode = SCALAR_INT_TYPE_MODE (utype);
       int optab_defined_at_zero
-	= leading ? CLZ_DEFINED_VALUE_AT_ZERO (mode, val)
-		  : CTZ_DEFINED_VALUE_AT_ZERO (mode, val);
+	= (leading
+	   ? CLZ_DEFINED_VALUE_AT_ZERO (SCALAR_INT_TYPE_MODE (utype), val)
+	   : CTZ_DEFINED_VALUE_AT_ZERO (SCALAR_INT_TYPE_MODE (utype), val));
       if (define_at_zero && !(optab_defined_at_zero == 2 && val == prec))
 	{
 	  tree is_zero = fold_build2 (NE_EXPR, boolean_type_node, src,
 				      build_zero_cst (TREE_TYPE (src)));
-	  call = fold_build3(COND_EXPR, integer_type_node, is_zero, call,
-			     build_int_cst (integer_type_node, prec));
+	  call = fold_build3 (COND_EXPR, integer_type_node, is_zero, call,
+			      build_int_cst (integer_type_node, prec));
 	}
     }
   else if (prec == 2 * lli_prec)
@@ -2275,22 +2275,22 @@ build_cltz_expr (tree src, bool leading, bool define_at_zero)
       /* We count the zeroes in src1, and add the number in src2 when src1
 	 is 0.  */
       if (!leading)
-	std::swap(src1, src2);
+	std::swap (src1, src2);
       tree call1 = build_call_expr (fn, 1, src1);
       tree call2 = build_call_expr (fn, 1, src2);
       if (define_at_zero)
 	{
 	  tree is_zero2 = fold_build2 (NE_EXPR, boolean_type_node, src2,
 				       build_zero_cst (TREE_TYPE (src2)));
-	  call2 = fold_build3(COND_EXPR, integer_type_node, is_zero2, call2,
-			      build_int_cst (integer_type_node, lli_prec));
+	  call2 = fold_build3 (COND_EXPR, integer_type_node, is_zero2, call2,
+			       build_int_cst (integer_type_node, lli_prec));
 	}
       tree is_zero1 = fold_build2 (NE_EXPR, boolean_type_node, src1,
 				   build_zero_cst (TREE_TYPE (src1)));
-      call = fold_build3(COND_EXPR, integer_type_node, is_zero1, call1,
-			 fold_build2 (PLUS_EXPR, integer_type_node, call2,
-				      build_int_cst (integer_type_node,
-						     lli_prec)));
+      call = fold_build3 (COND_EXPR, integer_type_node, is_zero1, call1,
+			  fold_build2 (PLUS_EXPR, integer_type_node, call2,
+				       build_int_cst (integer_type_node,
+						      lli_prec)));
     }
   else
     {
@@ -2302,14 +2302,13 @@ build_cltz_expr (tree src, bool leading, bool define_at_zero)
 	{
 	  tree is_zero = fold_build2 (NE_EXPR, boolean_type_node, src,
 				      build_zero_cst (TREE_TYPE (src)));
-	  call = fold_build3(COND_EXPR, integer_type_node, is_zero, call,
-			     build_int_cst (integer_type_node, prec));
+	  call = fold_build3 (COND_EXPR, integer_type_node, is_zero, call,
+			      build_int_cst (integer_type_node, prec));
 	}
 
       if (leading && prec < i_prec)
-	call = fold_build2(MINUS_EXPR, integer_type_node, call,
-			   build_int_cst (integer_type_node,
-					  i_prec - prec));
+	call = fold_build2 (MINUS_EXPR, integer_type_node, call,
+			    build_int_cst (integer_type_node, i_prec - prec));
     }
 
   return call;

                 reply	other threads:[~2023-01-20  9:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230120092427.E879438582BC@sourceware.org \
    --to=jakub@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).