From patchwork Thu Nov 25 10:54:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 48124 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 885893858435 for ; Thu, 25 Nov 2021 10:56:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 885893858435 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1637837796; bh=MoivHKmaMlMci4PAK2HyC7Iv0f1L1aLlIInWpSWWlW0=; 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=LBI7rNpssv+OaB/Xxs4e8a4ZsaUZSUvbD4FcQhxyxuIAexMxVSvwBFSDJbAgK19JU 7xjtxVHDV1m8tFSseALIXdqh+G/NL53ww8EBU//P5UwJhgdvjzDBz6LFRHfoL/9yCl GzDmpW4PLI57pOE1Oyra2p09PQMyObyxMWZuwT6E= 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 C259F3858C60 for ; Thu, 25 Nov 2021 10:55:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C259F3858C60 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-299-gfiYD-85M4a0ewrz8ENmwQ-1; Thu, 25 Nov 2021 05:55:08 -0500 X-MC-Unique: gfiYD-85M4a0ewrz8ENmwQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D4CCF5A07F for ; Thu, 25 Nov 2021 10:55:07 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.192.140]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9D91360C4A; Thu, 25 Nov 2021 10:55:05 +0000 (UTC) Received: from abulafia.quesejoda.com (localhost [127.0.0.1]) by abulafia.quesejoda.com (8.16.1/8.15.2) with ESMTPS id 1APAt33L2084750 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 25 Nov 2021 11:55:03 +0100 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.16.1/8.16.1/Submit) id 1APAt3ax2084749; Thu, 25 Nov 2021 11:55:03 +0100 To: GCC patches Subject: [COMMITTED] path solver: Move boolean import code to compute_imports. Date: Thu, 25 Nov 2021 11:54:59 +0100 Message-Id: <20211125105459.2084694-2-aldyh@redhat.com> In-Reply-To: <20211125105459.2084694-1-aldyh@redhat.com> References: <20211125105459.2084694-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.3 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_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" In a follow-up patch I will be pruning the set of exported ranges within blocks to avoid unnecessary work. In order to do this, all the interesting SSA names must be in the internal import bitmap ahead of time. I had already abstracted them out into compute_imports, but I missed the boolean code. This fixes the oversight. There's a net gain of 25 threadable paths, which is unexpected but welcome. Tested on x86-64 & ppc64le Linux. gcc/ChangeLog: PR tree-optimization/103254 * gimple-range-path.cc (path_range_query::compute_ranges): Move exported boolean code... (path_range_query::compute_imports): ...here. --- gcc/gimple-range-path.cc | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/gcc/gimple-range-path.cc b/gcc/gimple-range-path.cc index e24086691c4..806bce9ff11 100644 --- a/gcc/gimple-range-path.cc +++ b/gcc/gimple-range-path.cc @@ -537,7 +537,8 @@ void path_range_query::compute_imports (bitmap imports, basic_block exit) { // Start with the imports from the exit block... - bitmap r_imports = m_ranger->gori ().imports (exit); + gori_compute &gori = m_ranger->gori (); + bitmap r_imports = gori.imports (exit); bitmap_copy (imports, r_imports); auto_vec worklist (bitmap_count_bits (imports)); @@ -579,6 +580,16 @@ path_range_query::compute_imports (bitmap imports, basic_block exit) } } } + // Exported booleans along the path, may help conditionals. + if (m_resolve) + for (i = 0; i < m_path.length (); ++i) + { + basic_block bb = m_path[i]; + tree name; + FOR_EACH_GORI_EXPORT_NAME (gori, bb, name) + if (TREE_CODE (TREE_TYPE (name)) == BOOLEAN_TYPE) + bitmap_set_bit (imports, SSA_NAME_VERSION (name)); + } } // Compute the ranges for IMPORTS along PATH. @@ -622,18 +633,6 @@ path_range_query::compute_ranges (const vec &path, { basic_block bb = curr_bb (); - if (m_resolve) - { - gori_compute &gori = m_ranger->gori (); - tree name; - - // Exported booleans along the path, may help conditionals. - // Add them as interesting imports. - FOR_EACH_GORI_EXPORT_NAME (gori, bb, name) - if (TREE_CODE (TREE_TYPE (name)) == BOOLEAN_TYPE) - bitmap_set_bit (m_imports, SSA_NAME_VERSION (name)); - } - compute_ranges_in_block (bb); adjust_for_non_null_uses (bb);