From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 045B9385840A for ; Sun, 24 Jul 2022 15:04:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 045B9385840A 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-640-hCJjg2KbOEaxNIbKkz2NJw-1; Sun, 24 Jul 2022 11:04:39 -0400 X-MC-Unique: hCJjg2KbOEaxNIbKkz2NJw-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 3980885A581 for ; Sun, 24 Jul 2022 15:04:39 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.192.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D531F492CA2; Sun, 24 Jul 2022 15:04:38 +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 26OF4bYT2010509 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Sun, 24 Jul 2022 17:04:37 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.17.1/8.17.1/Submit) id 26OF4b662010508; Sun, 24 Jul 2022 17:04:37 +0200 From: Aldy Hernandez To: GCC patches Subject: [COMMITTED] Tweaks to global ranges. Date: Sun, 24 Jul 2022 17:04:30 +0200 Message-Id: <20220724150431.2010479-3-aldyh@redhat.com> In-Reply-To: <20220724150431.2010479-1-aldyh@redhat.com> References: <20220724150431.2010479-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 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.6 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-List-Received-Date: Sun, 24 Jul 2022 15:04:42 -0000 The global get_nonzero_bits was previously returning -1 for unsupported types. I dropped this in the conversion to global ranges and it's causing a problem in the frange work, where CCP is asking for the nonzero bits of non-integral types. CCP may require further tweaks, but for now, restore the original behavior. Also, I'm removing old checks for precision that no longer hold, now that we handle various types for global ranges. Tested on x86-64 Linux. gcc/ChangeLog: * tree-ssanames.cc (get_nonzero_bits): Return -1 for unsupported types. * value-query.cc (get_ssa_name_range_info): Remove precision check. --- gcc/tree-ssanames.cc | 3 +-- gcc/value-query.cc | 9 +++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/gcc/tree-ssanames.cc b/gcc/tree-ssanames.cc index 9389454a5a7..5c5d0e346c4 100644 --- a/gcc/tree-ssanames.cc +++ b/gcc/tree-ssanames.cc @@ -489,13 +489,12 @@ get_nonzero_bits (const_tree name) return wi::shwi (-1, precision); } - if (!range_info_p (name)) + if (!range_info_p (name) || !irange::supports_p (TREE_TYPE (name))) return wi::shwi (-1, precision); /* Optimization to get at the nonzero bits because we know the storage type. This saves us measurable time compared to going through vrange_storage. */ - gcc_checking_assert (irange::supports_p (TREE_TYPE (name))); irange_storage_slot *ri = static_cast (SSA_NAME_RANGE_INFO (name)); return ri->get_nonzero_bits (); diff --git a/gcc/value-query.cc b/gcc/value-query.cc index 51911bdd1d0..3560d19f1ae 100644 --- a/gcc/value-query.cc +++ b/gcc/value-query.cc @@ -280,16 +280,13 @@ get_ssa_name_range_info (vrange &r, const_tree name) void *ri = SSA_NAME_RANGE_INFO (name); - // Return VR_VARYING for SSA_NAMEs with NULL RANGE_INFO or SSA_NAMEs - // with integral types width > 2 * HOST_BITS_PER_WIDE_INT precision. - if (!ri || (GET_MODE_PRECISION (SCALAR_INT_TYPE_MODE (TREE_TYPE (name))) - > 2 * HOST_BITS_PER_WIDE_INT)) - r.set_varying (type); - else + if (ri) { vrange_storage vstore (NULL); vstore.get_vrange (ri, r, TREE_TYPE (name)); } + else + r.set_varying (type); } // Return nonnull attribute of pointer NAME from SSA_NAME_PTR_INFO. -- 2.36.1