From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 996F63858C62 for ; Thu, 19 Jan 2023 20:08:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 996F63858C62 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674158896; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=oXwiDlwV78+X1c5UgjDYz9beb94LIb2A0ZNueTfGk7Y=; b=e372WxPWvapSFeq0JXdzpkH2eMTAe4m+1KxrPp3mYwYYm1eg0nWznQapfLwHeHojoaiiBZ wzZHR4AK1YU1cEGIySVtsxBxGtHxbrmmEeAmMkkdDd01sR5FtXTYlTraQymIGEH+HyU6lt qoTwz5jyDWJ27AubGFQODle1LlOD23s= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-93-XcyVzNnwMySd3j0WvjKL7Q-1; Thu, 19 Jan 2023 15:08:13 -0500 X-MC-Unique: XcyVzNnwMySd3j0WvjKL7Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AD7082A59576; Thu, 19 Jan 2023 20:08:12 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.223]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 65D122026D76; Thu, 19 Jan 2023 20:08:12 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 30JK89Tj3366256 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Jan 2023 21:08:10 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 30JK88rR3366255; Thu, 19 Jan 2023 21:08:08 +0100 Date: Thu, 19 Jan 2023 21:08:08 +0100 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] niter: Fix up unused var warning [PR108457] Message-ID: Reply-To: Jakub Jelinek MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi! 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. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2023-01-19 Jakub Jelinek 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. --- gcc/tree-ssa-loop-niter.cc.jj 2023-01-16 11:52:05.806885510 +0100 +++ gcc/tree-ssa-loop-niter.cc 2023-01-19 13:10:42.872595970 +0100 @@ -2252,16 +2252,16 @@ build_cltz_expr (tree src, bool leading, 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, /* 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, { 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; Jakub