From patchwork Thu Nov 4 14:39:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 47055 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 0078D385801C for ; Thu, 4 Nov 2021 14:40:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0078D385801C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1636036831; bh=JYNJgktpgOamZA0CGTiOC25VXiUbJQn/jSgCRjiVyTk=; 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=ltsWzyDjSLue5jKkcsW8XwbqlO5SgnaVKGk50lSyAM4kfRamJ9WNkkIqcFsXs2N9Z 06qmeksxsB1p52vgi0zwunVtnPZQ1/iEssjHI8te3YNuaGLY/PslJ2vo1Y1dr3F0pu PXPOBO/KvIxTkD9lif4uL5vHNXk/l69C4cW3+O1c= 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 34AE73858D35 for ; Thu, 4 Nov 2021 14:40:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 34AE73858D35 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-582-ALBwvIqtOXOruHci9MtUrw-1; Thu, 04 Nov 2021 10:39:59 -0400 X-MC-Unique: ALBwvIqtOXOruHci9MtUrw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B3A929F92E for ; Thu, 4 Nov 2021 14:39:58 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.193.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 57B2D100E12D; Thu, 4 Nov 2021 14:39:58 +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 1A4Edu7K1102485 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 4 Nov 2021 15:39:56 +0100 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.16.1/8.16.1/Submit) id 1A4EduCR1102484; Thu, 4 Nov 2021 15:39:56 +0100 To: GCC patches Subject: [COMMITTED] Avoid repeating calculations in threader. Date: Thu, 4 Nov 2021 15:39:47 +0100 Message-Id: <20211104143948.1102399-2-aldyh@redhat.com> In-Reply-To: <20211104143948.1102399-1-aldyh@redhat.com> References: <20211104143948.1102399-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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_H2, 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" We already attempt to resolve the current path on entry to find_paths_to_name(), so there's no need to do so again for each exported range since nothing has changed. Removing this redundant calculation avoids 22% of calls into the path solver. Tested on x86-64 and ppc64le Linux with the usual regstrap. I also verified that the before and after number of threads was the same in a suite of .ii files from a bootstrap. gcc/ChangeLog: PR tree-optimization/102943 * tree-ssa-threadbackward.c (back_threader::find_paths_to_names): Avoid duplicate calculation of paths. --- gcc/tree-ssa-threadbackward.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/gcc/tree-ssa-threadbackward.c b/gcc/tree-ssa-threadbackward.c index 29e9d6a3f90..b7eaff94567 100644 --- a/gcc/tree-ssa-threadbackward.c +++ b/gcc/tree-ssa-threadbackward.c @@ -443,18 +443,6 @@ back_threader::find_paths_to_names (basic_block bb, bitmap interesting) goto leave_bb; } } - // Examine blocks that define or export an interesting SSA, - // since they may compute a range which resolve this path. - if ((def_bb == bb - || bitmap_bit_p (m_ranger->gori ().exports (bb), i)) - && m_path.length () > 1) - { - if (maybe_register_path ()) - { - done = true; - goto leave_bb; - } - } } // If there are interesting names not yet processed, keep looking.