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: 1688673 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=gWvgaToY; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Mmxzf3NWmz1yqk for ; Wed, 12 Oct 2022 00:52:13 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 64644385C416 for ; Tue, 11 Oct 2022 13:52:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 64644385C416 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1665496330; 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=gWvgaToYZHO5SS0fLA84LKxAxuyRkscZF+ri/5UVUTMvLHo0Qp/Vp4Vh61OkV/kXy c5OzYUzctogsEwtiL4W0vkvRmDS0a8rDz+njaHly+8/9RQO7p1xvKKUMx5D+4/7ZW7 X3Kr/+Z33GQbxvxD8yvWZejPXUVInFraxarp5W5c= 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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; }