From patchwork Wed Oct 19 21:15:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 5851 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp538995wrs; Wed, 19 Oct 2022 14:16:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7P9MF1GlJm0QKPYri/z4DFBS9xTsXaxZ9VNa4mzCADshWqrsCjSnvg4Ik/1P6lcVn2P0gY X-Received: by 2002:a17:907:7292:b0:78e:2eb5:6af2 with SMTP id dt18-20020a170907729200b0078e2eb56af2mr8493856ejc.261.1666214205236; Wed, 19 Oct 2022 14:16:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666214205; cv=none; d=google.com; s=arc-20160816; b=SVdN/jKsjXPm/nneriYsvcUoe1tsLLijSlHs13mb2njn9wNU/G2CRyCIVrVN7S8wGA pSmBalULa07byOMLnumZw0K9e5O3DIyKSnOq8D641Q+73Lg5Q6URDgVuq8SGi49YBwLO 8Dd6XxbuUo5+eWui4Oux97ySNEOXD1JWNZqu4k83Ht4frMRCMYyHcE2VB7BCCXrup8aM n6dGG5lfQLvFRGwcPZ56STBdZKX6gW0Wp//N4RrZR3wUU7WzSJ+TVeiXXDwcxbm36OeE h3NMTgLh0oLZNcGtklyGrTQaDukUvy/Cm4brQHO83fnV3fZXAp4prJ2/D7/dH3pipqSs Mi6w== 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=g8XQlWG+ErhpLwwNMyWeSYnTItEIByZgYBBx4aKRHvo=; b=Ti2xF/YrhvDZYXZdAMp4kvwpQYkV6oHM5PinDraTpbmjlCwCoiz/zh5/IDVAzr3pfp 510QZ+UdwE+kdK2/jbSRewqRo1fA4nMfafmz1qSod/mJA3vVnnQ38p0Dg2jVnB0qXZUp f7THa2/n/2D2a2fj1Yk5JMCIMKbPEhZ9BTqiLcyLQ0qrOm/9ZSq/gumShPs4jmVxwCfT uY/ZFTDFm70ExI8zOyzMR561l+M+X4zVqIZI+ztkAWeo3DEhRV7qwT71Yvo/CHMr0DFB HEnie/MlZjSJ1gi0Ci8z/A2U3ViNypS3uOOZ7l4as9GFkJncMBT5hArFBdC2z/Mk8QCg 1TTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=SmeBZHOJ; 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id m19-20020a056402431300b00448b88378f8si18038921edc.359.2022.10.19.14.16.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 14:16:45 -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=SmeBZHOJ; 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 40E74385841A for ; Wed, 19 Oct 2022 21:16:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 40E74385841A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666214204; bh=g8XQlWG+ErhpLwwNMyWeSYnTItEIByZgYBBx4aKRHvo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=SmeBZHOJ/AuDfWkFngCqPRkFUgI3KeRTu+mIOgvY5WlZCPtqqDnpaYqdIXmArOFD1 XQFeo/epN85WoFKa+bYqiM+6qLWc0t9oO448r4l59s9XfuwM1DRiocQLxAKA93EFJL OGh94ASpn6+RdnOGCZtyy3aPIs4IsUQVnCUy9PJY= 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 B14EA3857B9D for ; Wed, 19 Oct 2022 21:15:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B14EA3857B9D 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-54-tYGpsWvAO7iFrjL4xWBgMg-1; Wed, 19 Oct 2022 17:15:57 -0400 X-MC-Unique: tYGpsWvAO7iFrjL4xWBgMg-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 0FC371C05B02 for ; Wed, 19 Oct 2022 21:15:57 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AC25F2027061; Wed, 19 Oct 2022 21:15:56 +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 29JLFsQM135146 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 19 Oct 2022 23:15:54 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 29JLFr3G135145; Wed, 19 Oct 2022 23:15:53 +0200 To: GCC patches Subject: [COMMITTED] Always check result from build_ in range-op-float.cc Date: Wed, 19 Oct 2022 23:15:50 +0200 Message-Id: <20221019211550.135116-1-aldyh@redhat.com> 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 X-Spam-Status: No, score=-12.1 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, 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: 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?1747152226441420507?= X-GMAIL-MSGID: =?utf-8?q?1747152226441420507?= A result of false from build_ in range-ops means the result is final and needs no further adjustments. This patch documents this, and changes all uses to check the result. There should be no change in functionality. gcc/ChangeLog: * range-op-float.cc (build_le): Document result. (build_lt): Same. (build_ge): Same. (foperator_ge::op2_range): Check result of build_*. (foperator_unordered_le::op1_range): Same. (foperator_unordered_le::op2_range): Same. (foperator_unordered_gt::op1_range): Same. (foperator_unordered_gt::op2_range): Same. (foperator_unordered_ge::op1_range): Same. (foperator_unordered_ge::op2_range): Same. --- gcc/range-op-float.cc | 47 ++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/gcc/range-op-float.cc b/gcc/range-op-float.cc index e7334794b0d..0605a908684 100644 --- a/gcc/range-op-float.cc +++ b/gcc/range-op-float.cc @@ -239,7 +239,9 @@ frange_add_zeros (frange &r, tree type) } } -// Build a range that is <= VAL and store it in R. +// Build a range that is <= VAL and store it in R. Return TRUE if +// further changes may be needed for R, or FALSE if R is in its final +// form. static bool build_le (frange &r, tree type, const frange &val) @@ -255,7 +257,9 @@ build_le (frange &r, tree type, const frange &val) return true; } -// Build a range that is < VAL and store it in R. +// Build a range that is < VAL and store it in R. Return TRUE if +// further changes may be needed for R, or FALSE if R is in its final +// form. static bool build_lt (frange &r, tree type, const frange &val) @@ -277,7 +281,9 @@ build_lt (frange &r, tree type, const frange &val) return true; } -// Build a range that is >= VAL and store it in R. +// Build a range that is >= VAL and store it in R. Return TRUE if +// further changes may be needed for R, or FALSE if R is in its final +// form. static bool build_ge (frange &r, tree type, const frange &val) @@ -293,7 +299,9 @@ build_ge (frange &r, tree type, const frange &val) return true; } -// Build a range that is > VAL and store it in R. +// Build a range that is > VAL and store it in R. Return TRUE if +// further changes may be needed for R, or FALSE if R is in its final +// form. static bool build_gt (frange &r, tree type, const frange &val) @@ -979,11 +987,8 @@ foperator_ge::op2_range (frange &r, tree type, // The TRUE side of NAN >= x is unreachable. if (op1.known_isnan ()) r.set_undefined (); - else - { - build_le (r, type, op1); - r.clear_nan (); - } + else if (build_le (r, type, op1)) + r.clear_nan (); break; case BRS_FALSE: @@ -1354,8 +1359,8 @@ foperator_unordered_le::op1_range (frange &r, tree type, break; case BRS_FALSE: - build_gt (r, type, op2); - r.clear_nan (); + if (build_gt (r, type, op2)) + r.clear_nan (); break; default: @@ -1378,8 +1383,8 @@ foperator_unordered_le::op2_range (frange &r, break; case BRS_FALSE: - build_lt (r, type, op1); - r.clear_nan (); + if (build_lt (r, type, op1)) + r.clear_nan (); break; default: @@ -1437,8 +1442,8 @@ foperator_unordered_gt::op1_range (frange &r, break; case BRS_FALSE: - build_le (r, type, op2); - r.clear_nan (); + if (build_le (r, type, op2)) + r.clear_nan (); break; default: @@ -1461,8 +1466,8 @@ foperator_unordered_gt::op2_range (frange &r, break; case BRS_FALSE: - build_ge (r, type, op1); - r.clear_nan (); + if (build_ge (r, type, op1)) + r.clear_nan (); break; default: @@ -1520,8 +1525,8 @@ foperator_unordered_ge::op1_range (frange &r, break; case BRS_FALSE: - build_lt (r, type, op2); - r.clear_nan (); + if (build_lt (r, type, op2)) + r.clear_nan (); break; default: @@ -1543,8 +1548,8 @@ foperator_unordered_ge::op2_range (frange &r, tree type, break; case BRS_FALSE: - build_gt (r, type, op1); - r.clear_nan (); + if (build_gt (r, type, op1)) + r.clear_nan (); break; default: