From patchwork Thu Jan 19 20:08:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 45951 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp522367wrn; Thu, 19 Jan 2023 12:09:00 -0800 (PST) X-Google-Smtp-Source: AMrXdXsNxyNHpfpmQI4mskFFJRewcR0lRTN6HiAR5WduC6Ysj1Shfcc8kHerYZLHpd0QnBHq2Hmx X-Received: by 2002:a17:906:244b:b0:7be:fb2c:c112 with SMTP id a11-20020a170906244b00b007befb2cc112mr12424477ejb.66.1674158940876; Thu, 19 Jan 2023 12:09:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674158940; cv=none; d=google.com; s=arc-20160816; b=JFBFUpHJyHUIlH2w4GZAKoR7VVTViczeG/ZygYBiVCioFfGcqLwkXJS3N3RK3CJFxQ 5iK29xcBsjtXtsGBLuHapsCpLZQEQ0i2S9S5OlY8vA3983ySZ3hzZBcCP+xWcGQz/wr4 1Z2Dh52JHWjNaYcCn0f+CoV9fCqWTTm9kQm/+wEiukpSZot9m0ZHqhpa/KGOSPvZe3Tx /j3e+I77ASUGo39D5DT9x8t3fludCeJ4gglBh77ZYX3lMfjxTsGtDZkiESXKcSTniSB1 YmWqrAepB34jC4u9K9tmfQR3BKVzj0+PUP38SdFgwSP5JfoGert+ah9sOgWzyLKoXJqX kMvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:cc:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=oXwiDlwV78+X1c5UgjDYz9beb94LIb2A0ZNueTfGk7Y=; b=IDSrgmPvnMFfMY+aKL6UaC9DzLeRjbS7WYcwNYE9MLMMVxfRV3TPrKC5+4B2IA5SWZ jc3SABJ+g7GY5Rmm64ZaP+jwT+NqyzT+CiuifptiBBoY0w/rFSuEdFjo+VZ5G39XqqYe NAZOOiD0YUTC5fQhQcuXyOZD23Azub+P7USjlMo8z9U+H5hE5JRjkl44ocKROYlI44XP i5xoIwQWk7joDJIqY/g4aBmyaEbxoXR08g30nMLPo79KhX7WF6FRuVlSYAxNTC1pZaA5 DDo6vccHvsdDViyNwzfPgqYApyoZAwz0Aiogmoo5Fk3CVcBvQmLqpnFLlksG/iM065Nf J5BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="AeXgh7/k"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id sg11-20020a170907a40b00b007c0b03b23b5si1763378ejc.542.2023.01.19.12.09.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jan 2023 12:09:00 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="AeXgh7/k"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ACEE33858421 for ; Thu, 19 Jan 2023 20:08:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ACEE33858421 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674158939; bh=oXwiDlwV78+X1c5UgjDYz9beb94LIb2A0ZNueTfGk7Y=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=AeXgh7/kElVnjkTos3GG8rtEdpI1BrUH+Xzi/Zr2/N0A99cpeA94eX2dn2JhtVmvy /G7B3g7AAuuYQrr9PUZ3Uh9FjJ4LJLhV6eXWPTzlKDDTAhi86s5z+b1RYZRl2F9vD0 QsnWE9qeFwSG7UHpizZQ7x9yhh1Vf9JFZ3bjcPWU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 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 To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] niter: Fix up unused var warning [PR108457] Message-ID: 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-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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755482885552922784?= X-GMAIL-MSGID: =?utf-8?q?1755482885552922784?= 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. Jakub --- 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;