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 ESMTP id 964C93858007 for ; Thu, 14 Oct 2021 13:43:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 964C93858007 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-250-6odCwpPPMrm5TcAyc2ialg-1; Thu, 14 Oct 2021 09:43:03 -0400 X-MC-Unique: 6odCwpPPMrm5TcAyc2ialg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 366C1120B380 for ; Thu, 14 Oct 2021 13:43:02 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.193.225]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CEA425C232; Thu, 14 Oct 2021 13:43:01 +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 19EDgw7U237714 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 14 Oct 2021 15:42:59 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.16.1/8.16.1/Submit) id 19EDgwIE237713; Thu, 14 Oct 2021 15:42:58 +0200 From: Aldy Hernandez To: GCC patches Subject: [COMMITTED] Add FIXME note to backward threader. Date: Thu, 14 Oct 2021 15:42:51 +0200 Message-Id: <20211014134251.237651-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-13.1 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-List-Received-Date: Thu, 14 Oct 2021 13:43:05 -0000 There's a limitation in the path discovery bits in the backward threader that I ran into recently and I'd like to document it so we don't lose track of it. Basically we stop looking if we find a threadable path through a PHI, without taking into account that there could be multiple paths through a PHI that resolve the path. For example: x_5 = PHI <10(4), 20(5), ...> if (x_5 > 5) I don't remember how we ended up skipping this, but it could existing behavior from the old bits. It probably skipped multiple threads through a PHI since the generic copier couldn't re-using existing threading paths anyhow. Documenting for later fixing. --- gcc/tree-ssa-threadbackward.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gcc/tree-ssa-threadbackward.c b/gcc/tree-ssa-threadbackward.c index 28c7ef8c872..496b68e0a82 100644 --- a/gcc/tree-ssa-threadbackward.c +++ b/gcc/tree-ssa-threadbackward.c @@ -282,6 +282,13 @@ back_threader::resolve_phi (gphi *phi, bitmap interesting) continue; } + // FIXME: We currently stop looking if we find a threadable path + // through a PHI. This is pessimistic, as there can be multiple + // paths that can resolve the path. For example: + // + // x_5 = PHI <10(4), 20(5), ...> + // if (x_5 > 5) + tree arg = gimple_phi_arg_def (phi, i); if (TREE_CODE (arg) == SSA_NAME) { -- 2.31.1