From patchwork Tue Oct 11 13:51:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 1922 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp2108375wrs; Tue, 11 Oct 2022 06:53:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4dkKam1xA8yeeLXaU3vrq8yWV7aTmgkunjBUDk0wlpRsKE8AtxxCDC7McEQXTiYfXQGrN/ X-Received: by 2002:a17:907:a4e:b0:77d:94d:8148 with SMTP id be14-20020a1709070a4e00b0077d094d8148mr18400712ejc.607.1665496380105; Tue, 11 Oct 2022 06:53:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665496380; cv=none; d=google.com; s=arc-20160816; b=cvPNbzjSc4ZIzV1LkNvBVfM3pC4IEYE+0pbX3Igpw+bN01cSoOBHZaFSU/ZkOJJfrU 4/iY02iUYf2Dd5AaqjA3S0+52UBhUWJT9y4cVhsfhieJIzh5doa+nOeejdeNO1fUMKjD hf5PpG8lnQtRLyb0RdH6pPSwUXogtx7VB6Bii6X8ba1m306Ala8XdTMESlXnWgKvoGgr /q0wKYpZfKyQB/Yksqd3rN4jEBeCJ6PqdEUaEuPY1rv26sVH9b0vEsa6+Jm8giTeUAmM MDgbEIfs50SQepm8nKWZrwx7eHSXl8dPT02wst4Gs+kndnfL2m7v0rRmo/o/2LxH2H0i Ye0w== 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=d5LgUS7iWPtCZU+CgPvU/peEOtKPbrdFauVr2g9Xzgk=; b=hm2ZUNvK6vRzqzN3e/z8b2PH2TiE5S3hIKeRx9p5F5cF4UJFLdACXB2vmXJhoL7f7r DMzXaXVk3dy0z6ogP1wJM3iyPNC+TLp0RhMJv8ychPbrEFFd3wcIAcA4sveM1XF/T/Pd 0XbDeOqlwA/JlEdG4tTexEm0yGfB3bMcvvbXXCIP9mLD72Zmz2U0p6aXNFV8IoJTMYLw Y2vyPS1Ll0OWII+d4UxnofZ7ah1fLBewJDt1/+TEww14VkWtEx2uGxA/jwr0QJcpvx87 g5zwqHr+2iX71A3cBZpT+Ae6NapxkorrLxpWea2d1bEk6efZlhgoT+Fc2Lp5CthGpy9a 1v0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ns2TILUy; 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 du15-20020a17090772cf00b007878c9d73a2si15762461ejc.426.2022.10.11.06.52.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Oct 2022 06:53:00 -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=ns2TILUy; 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 9A40E3853570 for ; Tue, 11 Oct 2022 13:52:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9A40E3853570 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665496357; bh=d5LgUS7iWPtCZU+CgPvU/peEOtKPbrdFauVr2g9Xzgk=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=ns2TILUyZJfb1qjNrNtW/j+2iYAu6oWrIHwv7vqiEbgEzePmv/1rHiwAWl3GguoPM 24DNK99DVVoWH+CFnvsmQAZG6qcQ/z+AXub7UdlEexedgLynvXAR2URBjVf/zmeCzk 7TUZ0OrVGebW0iFDXNgxFC3pSsm+3tMIV71Uojoc= 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 26EF33858C2D for ; Tue, 11 Oct 2022 13:51:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 26EF33858C2D 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-613-yeByEbUINDWyEh5FYyDY0Q-1; Tue, 11 Oct 2022 09:51:46 -0400 X-MC-Unique: yeByEbUINDWyEh5FYyDY0Q-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 80853101245E for ; Tue, 11 Oct 2022 13:51:46 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.194.162]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 27486207B372; Tue, 11 Oct 2022 13:51:45 +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 29BDphil369674 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 11 Oct 2022 15:51:43 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 29BDph30369673; Tue, 11 Oct 2022 15:51:43 +0200 To: GCC patches Subject: [COMMITTED] Move TRUE case first in range-op.cc. Date: Tue, 11 Oct 2022 15:51:33 +0200 Message-Id: <20221011135136.369644-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=-11.5 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?1746399532352752873?= X-GMAIL-MSGID: =?utf-8?q?1746399532352752873?= It's incredibly annoying that some of the BRS_TRUE cases come after BRS_FALSE, if only because we're not consistent. Having random ordering increases the changes of thinkos when adapting the irange code to floats. gcc/ChangeLog: * range-op.cc (operator_equal::op1_range): Move BRS_TRUE case up. (operator_lt::op2_range): Same. (operator_le::op2_range): Same. (operator_gt::op2_range): Same. (operator_ge::op2_range): Same. --- gcc/range-op.cc | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/gcc/range-op.cc b/gcc/range-op.cc index df0735cb42a..4d5a033dfa5 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -531,6 +531,11 @@ operator_equal::op1_range (irange &r, tree type, { switch (get_bool_state (r, lhs, type)) { + case BRS_TRUE: + // If it's true, the result is the same as OP2. + r = op2; + break; + case BRS_FALSE: // If the result is false, the only time we know anything is // if OP2 is a constant. @@ -543,11 +548,6 @@ operator_equal::op1_range (irange &r, tree type, r.set_varying (type); break; - case BRS_TRUE: - // If it's true, the result is the same as OP2. - r = op2; - break; - default: break; } @@ -841,14 +841,14 @@ operator_lt::op2_range (irange &r, tree type, { switch (get_bool_state (r, lhs, type)) { - case BRS_FALSE: - build_le (r, type, op1.upper_bound ()); - break; - case BRS_TRUE: build_gt (r, type, op1.lower_bound ()); break; + case BRS_FALSE: + build_le (r, type, op1.upper_bound ()); + break; + default: break; } @@ -952,14 +952,14 @@ operator_le::op2_range (irange &r, tree type, { switch (get_bool_state (r, lhs, type)) { - case BRS_FALSE: - build_lt (r, type, op1.upper_bound ()); - break; - case BRS_TRUE: build_ge (r, type, op1.lower_bound ()); break; + case BRS_FALSE: + build_lt (r, type, op1.upper_bound ()); + break; + default: break; } @@ -1062,14 +1062,14 @@ operator_gt::op2_range (irange &r, tree type, { switch (get_bool_state (r, lhs, type)) { - case BRS_FALSE: - build_ge (r, type, op1.lower_bound ()); - break; - case BRS_TRUE: build_lt (r, type, op1.upper_bound ()); break; + case BRS_FALSE: + build_ge (r, type, op1.lower_bound ()); + break; + default: break; } @@ -1173,14 +1173,14 @@ operator_ge::op2_range (irange &r, tree type, { switch (get_bool_state (r, lhs, type)) { - case BRS_FALSE: - build_gt (r, type, op1.lower_bound ()); - break; - case BRS_TRUE: build_le (r, type, op1.upper_bound ()); break; + case BRS_FALSE: + build_gt (r, type, op1.lower_bound ()); + break; + default: break; }