From patchwork Thu Oct 14 13:42:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 46213 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 2EB543858C2C for ; Thu, 14 Oct 2021 13:44:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2EB543858C2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1634219074; bh=hmb/5xVdl+DtOujFrXTgntbbphOdGZZc7wPLCwMn2us=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=hvr0JD7jIk/aes2avpeTiBsHxlwMHRDhDPLYwqmoU02cDSTqUYX6zDdx97FdUSkKl l6rx6Avof2OG96YQMATEq69twR8OHhOvPsACXugw/T79Ks28JBkG5oV3BnWrDrPo9t yR6QQfsCPcKpuRG5s19NsggFgdfppXtRA/k5612E= 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 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 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 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-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" 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) {