From patchwork Fri Sep 23 12:58:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 1419 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp202183wrt; Fri, 23 Sep 2022 05:59:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4JuYEfeFsgFhrywcu8pIDP8/WfgzSMb3xxwV8nkcgIpT1ljUWL6RDCT3IlSavyFEjQjzI5 X-Received: by 2002:a17:907:3f9f:b0:782:a14a:fdf9 with SMTP id hr31-20020a1709073f9f00b00782a14afdf9mr2382431ejc.49.1663937963375; Fri, 23 Sep 2022 05:59:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663937963; cv=none; d=google.com; s=arc-20160816; b=nZ+Qa/LqFxb9KK9I1ps1YCZUPIFs2ecZylB3f6b+BbSpf9vUjSrtkQ696A7ByBtsRu V+BKuRcVYzkbIZ3B+hxy5WPGVjmi55HGHEoMOr5wcYKBFYEqUWTaa/yfCy5BC7agHQ6l MDfrAw65wVBWdynkl/FWvp3nfdLxSM8tzyE1y5lwVcjHZkXGzRNbkzaMw5It0xywy6Pk 8KKL8fdb0GkGNSjRJ843lrWwlLJvp8b/lo3yYYb/xsqg9N1enM+GFbyploW35uWBE0Ph uCg3/dPDJREJIlEfRsul+4Nc4gQ7SifymylXOjIZLol+V2m7EXsAL/ozdKzkVMYKqKgD Vb1Q== 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-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=KLYf6OtLsOfT6U+BLD5GUATc1EhGVpxF6LDqQDD6O3A=; b=PPpNiOm9aEy0w8U2sEmPMdOhqsM55S7Q9XQ6SlfIfTz9J+PAtlSmt6X6q32n0dT/XZ 6sRivY0p3yZEHp96jkfZwEk7TxJ38UYYl+l8S/+HLvyh7tce5jVG4P1ILC7Dr1fP90e0 7uDiUnz2TJ/k+JjcPMUTsNbuXTHHQxlkt1kPKj/E9cxDpFUxRRSrIz1IGsNUGHKiLkoH 9wtJsyHABP+PV3gNfsgNxncub93FBUb9fc+YvPeNxv8TG+gJmmmaePTL27L4X4UXdjj/ 9RD85cBrguwar6iT7yESDM3zfwzKMywz/eDQ0RoFDOKoJtPNIFIeKuJL2yBL9O71T1tG hzYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="Yguly/x2"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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. [8.43.85.97]) by mx.google.com with ESMTPS id n19-20020a17090695d300b007771bc8dbb4si5693838ejy.781.2022.09.23.05.59.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Sep 2022 05:59:23 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="Yguly/x2"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 5B0C03857340 for ; Fri, 23 Sep 2022 12:59:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5B0C03857340 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663937962; bh=KLYf6OtLsOfT6U+BLD5GUATc1EhGVpxF6LDqQDD6O3A=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Yguly/x2eJ6AkmUES5rWiq6GUpCvUbRR98XJpq1cU5XNjlL/hBxXYzh7VXG2yoyoe bRVXEYtGzWRjNVVBf4zjNAsc/wDMCTzjT+GDTaZu+3w2AFI3oDDx61QT8pBScMIjHk um5XVpRb6HK4RgetE21kfNXdu2+YuPZsECDrUi7c= 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 10CAE3858C52 for ; Fri, 23 Sep 2022 12:58:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 10CAE3858C52 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-315-mYO7yy66PjGZ2GsRkyKbzg-1; Fri, 23 Sep 2022 08:58:37 -0400 X-MC-Unique: mYO7yy66PjGZ2GsRkyKbzg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C53C41C09CAA for ; Fri, 23 Sep 2022 12:58:35 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.194.89]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D6DF18EB4; Fri, 23 Sep 2022 12:58:35 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.17.1/8.17.1) with ESMTPS id 28NCwW2I2715556 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 23 Sep 2022 14:58:32 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 28NCwWQZ2715555; Fri, 23 Sep 2022 14:58:32 +0200 To: GCC patches Subject: [COMMITTED] frange: Make the setter taking trees a wrapper. Date: Fri, 23 Sep 2022 14:58:30 +0200 Message-Id: <20220923125830.2715538-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, 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: Aldy Hernandez via Gcc-patches From: Aldy Hernandez Reply-To: Aldy Hernandez 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?1744765413839714054?= X-GMAIL-MSGID: =?utf-8?q?1744765413839714054?= The frange setter does all its work in trees. This incurs a penalty for the real_value variants because they must wrap their arguments into a tree and pass it to the tree setter, which will then do the opposite. This is leftovers from the irange setter. Even though the we still need constructors taking trees so we can interact with the tree world, there's no sense penalizing the rest of the implementation. Tested on x86-64 Linux. gcc/ChangeLog: * value-range.cc (frange::set): Swap setters such that the one accepting REAL_VALUE_TYPE does all the work. --- gcc/value-range.cc | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/gcc/value-range.cc b/gcc/value-range.cc index 43905ba4901..9ca442478c9 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -290,7 +290,9 @@ frange::flush_denormals_to_zero () // Setter for franges. void -frange::set (tree min, tree max, value_range_kind kind) +frange::set (tree type, + const REAL_VALUE_TYPE &min, const REAL_VALUE_TYPE &max, + value_range_kind kind) { switch (kind) { @@ -299,7 +301,7 @@ frange::set (tree min, tree max, value_range_kind kind) return; case VR_VARYING: case VR_ANTI_RANGE: - set_varying (TREE_TYPE (min)); + set_varying (type); return; case VR_RANGE: break; @@ -308,14 +310,12 @@ frange::set (tree min, tree max, value_range_kind kind) } // Handle NANs. - if (real_isnan (TREE_REAL_CST_PTR (min)) || real_isnan (TREE_REAL_CST_PTR (max))) + if (real_isnan (&min) || real_isnan (&max)) { - gcc_checking_assert (real_identical (TREE_REAL_CST_PTR (min), - TREE_REAL_CST_PTR (max))); - tree type = TREE_TYPE (min); + gcc_checking_assert (real_identical (&min, &max)); if (HONOR_NANS (type)) { - bool sign = real_isneg (TREE_REAL_CST_PTR (min)); + bool sign = real_isneg (&min); set_nan (type, sign); } else @@ -324,9 +324,9 @@ frange::set (tree min, tree max, value_range_kind kind) } m_kind = kind; - m_type = TREE_TYPE (min); - m_min = *TREE_REAL_CST_PTR (min); - m_max = *TREE_REAL_CST_PTR (max); + m_type = type; + m_min = min; + m_max = max; if (HONOR_NANS (m_type)) { m_pos_nan = true; @@ -351,7 +351,7 @@ frange::set (tree min, tree max, value_range_kind kind) } // Check for swapped ranges. - gcc_checking_assert (tree_compare (LE_EXPR, min, max)); + gcc_checking_assert (real_compare (LE_EXPR, &min, &max)); normalize_kind (); @@ -361,14 +361,11 @@ frange::set (tree min, tree max, value_range_kind kind) verify_range (); } -// Setter for frange from REAL_VALUE_TYPE endpoints. - void -frange::set (tree type, - const REAL_VALUE_TYPE &min, const REAL_VALUE_TYPE &max, - value_range_kind kind) +frange::set (tree min, tree max, value_range_kind kind) { - set (build_real (type, min), build_real (type, max), kind); + set (TREE_TYPE (min), + *TREE_REAL_CST_PTR (min), *TREE_REAL_CST_PTR (max), kind); } // Normalize range to VARYING or UNDEFINED, or vice versa. Return