From patchwork Tue Aug 2 12:24:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 353 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6a10:b5d6:b0:2b9:3548:2db5 with SMTP id v22csp2942726pxt; Tue, 2 Aug 2022 05:25:49 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tMrQnOP/RekFv1o7eJffInD9oP/XE+T8/dby3kPqUHGPZ5/irJTv8X1pXUrZJKjnG+Aiha X-Received: by 2002:a05:6402:350b:b0:43a:e18e:dee6 with SMTP id b11-20020a056402350b00b0043ae18edee6mr20305354edd.31.1659443149532; Tue, 02 Aug 2022 05:25:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659443149; cv=none; d=google.com; s=arc-20160816; b=XGDB23pi4sx/p43erWi+eBG+POwc7mZVg3isbR9vgC+O304uo1aQOK8ZrOCoyqCTtw kea1R0O3Nk+X7qz/M9RYPpuk0uTA7aVaTFwyhqR+XTdic2IeKvBO6RAIbx/BAyDH2BlK VP3eNArbNrpZ3vOjlf40JSEIs/hAG8mIs/ZhYKIuZFflk54Semlor40g3yfAwgZF35g6 REFL2y5V5wO6MiSYGTYXaSymNyk+ixvGnkE9erUWMFVeZ6KYHV106enatmGyD8m/381c Jln7NDopLd+40EulYh4cMmt0FDUMdxK34uM6BB9pk7fR1efLiZGjfEhyNs+9kZGGQb++ 9alA== 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=oTPrU1zC9fC1eHd8bLKkCgK+PrzuPAbO8vdiXN4v4q0=; b=c7dK/G7S2ZFfzAnwZETm/WVRf5ved+DEmFsm1sS9dRYyoZ59ml5+oGQ2S3S0dhziFE +P8qiKcOZmfC1BVU24QPNVN6Z0lp2UoV88ZwLcuXNgUXeluwBUZyzbNqoMipkayQwUBZ 8nH9Qyq2M9YYoEnWYHwT9R3SVp3lqqCttjt8L6P31RAw9IAfGPPvivHVrvv4qqEqzMgX ZhyzjHHH8JaRA3HWYDn6HdR4WVcnKNnnXwY3DJcexNEsebPKH1I+75p0mk+KoHBJvyW7 J+IIJXkTklqwF8V6ihLmhYY3eOSQyR2HbIofV4PxkcOOgx+FuQabtrdnlRHKqlI6Wvmp pRFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="J/933f5r"; 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 f36-20020a05640232a400b0043d7f8da634si3207249eda.452.2022.08.02.05.25.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Aug 2022 05:25:49 -0700 (PDT) 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="J/933f5r"; 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 D4810384A890 for ; Tue, 2 Aug 2022 12:25:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D4810384A890 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1659443134; bh=oTPrU1zC9fC1eHd8bLKkCgK+PrzuPAbO8vdiXN4v4q0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=J/933f5rmzlrTCmvlFhS49cFSHVWGfEBnWHXiGjMcC76sDy/Ry4Er3Am27FhwvZ9P 9IeUHmgCBxsj72Kd18wJoFtXn2GWrRPDweWuSY811bjy/oQVOe58p3wyJJWITRe5hA Sr/MgJ2qWWAmTnf/ZB3avb6GfRVIxb+7Pbg8YwzA= 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.133.124]) by sourceware.org (Postfix) with ESMTPS id 752863852745 for ; Tue, 2 Aug 2022 12:24:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 752863852745 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-426-feIwhAyhNFCxqoypMuKDqw-1; Tue, 02 Aug 2022 08:24:12 -0400 X-MC-Unique: feIwhAyhNFCxqoypMuKDqw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F2DE4805AF5; Tue, 2 Aug 2022 12:24:11 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.195.99]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A7F03492C3B; Tue, 2 Aug 2022 12:24:11 +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 272COAvh336130 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 2 Aug 2022 14:24:10 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 272CO9HO336129; Tue, 2 Aug 2022 14:24:09 +0200 To: GCC patches Subject: [PATCH] More frange::set cleanups. Date: Tue, 2 Aug 2022 14:24:05 +0200 Message-Id: <20220802122407.336092-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.7 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_NONE, 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?1740052259943433807?= X-GMAIL-MSGID: =?utf-8?q?1740052259943433807?= Will commit pending a final round of tests. gcc/ChangeLog: * value-range.cc (frange::set): Initialize m_props and cleanup. --- gcc/value-range.cc | 47 +++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/gcc/value-range.cc b/gcc/value-range.cc index dc06f8b0078..dd5a4303908 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -292,38 +292,47 @@ frange::set (tree min, tree max, value_range_kind kind) m_kind = kind; m_type = TREE_TYPE (min); - - // Mark NANness. - if (real_isnan (TREE_REAL_CST_PTR (min)) - || real_isnan (TREE_REAL_CST_PTR (max))) - { - gcc_checking_assert (operand_equal_p (min, max)); - m_props.nan_set_yes (); - } - else - m_props.nan_set_no (); + m_props.set_varying (); bool is_min = vrp_val_is_min (min); bool is_max = vrp_val_is_max (max); + bool is_nan = (real_isnan (TREE_REAL_CST_PTR (min)) + || real_isnan (TREE_REAL_CST_PTR (max))); - // Mark when the endpoints can't be INF. - if (!is_min) - m_props.ninf_set_no (); - if (!is_max) - m_props.inf_set_no (); + // Ranges with a NAN and a non-NAN endpoint are nonsensical. + gcc_checking_assert (!is_nan || operand_equal_p (min, max)); - // Mark when the endpoints are definitely INF. + // The properties for singletons can be all set ahead of time. if (operand_equal_p (min, max)) { + // Set INF properties. if (is_min) m_props.ninf_set_yes (); - else if (is_max) + else + m_props.ninf_set_no (); + if (is_max) m_props.inf_set_yes (); + else + m_props.inf_set_no (); + // Set NAN property. + if (is_nan) + m_props.nan_set_yes (); + else + m_props.nan_set_no (); + } + else + { + // Mark when the endpoints can't be +-INF. + if (!is_min) + m_props.ninf_set_no (); + if (!is_max) + m_props.inf_set_no (); } // Check for swapped ranges. - gcc_checking_assert (m_props.nan_yes_p () - || tree_compare (LE_EXPR, min, max)); + gcc_checking_assert (is_nan || tree_compare (LE_EXPR, min, max)); + + normalize_kind (); if (flag_checking) verify_range ();