From patchwork Mon Oct 3 11:08:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 1651 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp893563wrs; Mon, 3 Oct 2022 04:09:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM74FG7btzWLlN9C8IEXTi/7TJmkhSlvCL+pdwbt3/kLVMI3T3k9ECbiTP+sfpge3OnjfG6N X-Received: by 2002:a17:907:2cd5:b0:77c:b9cb:bdac with SMTP id hg21-20020a1709072cd500b0077cb9cbbdacmr14996835ejc.265.1664795357278; Mon, 03 Oct 2022 04:09:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664795357; cv=none; d=google.com; s=arc-20160816; b=ToSV2lFYzxmiDG2Kfkje/aEr845H5vabqnPpD71Bw9oiATgmt0inVAVM3sOsaGz2t6 smbvCqpQENteYZv/WVlOjkwUblUF61JBuUsn3nkC28OhphElSnRNRlUHvatR9CIyRBKR LPDBYBjYd+nmz9SOanbl9coJIfLmvkgqGsruU08tAIONufNdfJDSes1J2d9GgO5hCJbK aE+ShipBEXwsPNtm+r2maL5rwjKRYV6s+nbHvhJi3oWZPWE8qyVQZhJsJzdwAKwMMl2Z F+I7wNeMUMimVISPqrSCTBlJdAxC71hnYmgh8++8XzVkNibyMMX9JUyYGX6nY+ok7Tc+ wdrQ== 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:references:in-reply-to :message-id:date:subject:to:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=fgVrQ0ffUibp1/rLRq11fE7Xu9/vYWkfebccpTlSAIU=; b=TgK211ZwMMrd6FOUvzvGGdjzgLLua/I3i5/kmWRO31oB8pTjZUhm6fo/WJ+V1ZpyXU gcyOXajEozF/J3f9lWo34uumYJLLDDthjSaWMwo80B61KhvuWQwfaBiiAMt9i7TQYPPk vvqZB7pvxMSIXrjf439wYCycAM6zATB/S6q5GBg3eQ0NTPGHh6gfYO8lM9r0eGH7RCCb EI3lFWLzWChshFt+AYtDl+aafS1Wmx/qx2I5c+Sr2pBiS/YtAvwYqFbejtMd3C2DwCtB B09+/y7vsppfJSYhBnUU7nRGSCmrknIVGjdn2zOzztfgGhPVhjI7YpBojL152ACi5EiW v4wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=kLiKLrzc; 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 nb28-20020a1709071c9c00b0078164647095si7775959ejc.68.2022.10.03.04.09.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Oct 2022 04:09:17 -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=kLiKLrzc; 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 9030F3857022 for ; Mon, 3 Oct 2022 11:09:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9030F3857022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664795345; bh=fgVrQ0ffUibp1/rLRq11fE7Xu9/vYWkfebccpTlSAIU=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=kLiKLrzcPnykHf2UFUswDEpfY+rwO5Y6fvaS0g6X7mYoxUAxdCHAijInySFuF+92l XcCywrtCQSpBLrUxQEVOzE3ztgmKDM+jP4euv9SFjR1wV9Z7bSWaf4IWLntA7BbzXv nGYtuIZRd9c/EzNU8WC7jPDVYJ1MqCX9K5G7oBKE= 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 86C4F3858401 for ; Mon, 3 Oct 2022 11:08:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 86C4F3858401 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-480-3t95F4JCOlme7pYFdclSNQ-1; Mon, 03 Oct 2022 07:08:21 -0400 X-MC-Unique: 3t95F4JCOlme7pYFdclSNQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0FA6C833941 for ; Mon, 3 Oct 2022 11:08:21 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.194.103]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 72BE940C206B; Mon, 3 Oct 2022 11:08:20 +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 293B8Jev1076003 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 3 Oct 2022 13:08:19 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 293B8JCl1076002; Mon, 3 Oct 2022 13:08:19 +0200 To: GCC patches Subject: [COMMITTED] Avoid comparing ranges when sub-ranges is 0. Date: Mon, 3 Oct 2022 13:08:14 +0200 Message-Id: <20221003110815.1075975-3-aldyh@redhat.com> In-Reply-To: <20221003110815.1075975-1-aldyh@redhat.com> References: <20221003110815.1075975-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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?1745664456985414929?= X-GMAIL-MSGID: =?utf-8?q?1745664456985414929?= There is nothing else to compare when the number of sub-ranges is 0. gcc/ChangeLog: * value-range.cc (irange::operator==): Early bail on m_num_ranges equal to 0. --- gcc/value-range.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/value-range.cc b/gcc/value-range.cc index ddbcdd67633..e1066f4946e 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -1260,6 +1260,9 @@ irange::operator== (const irange &other) const if (m_num_ranges != other.m_num_ranges) return false; + if (m_num_ranges == 0) + return true; + for (unsigned i = 0; i < m_num_ranges; ++i) { tree lb = tree_lower_bound (i);