From patchwork Wed Oct 27 18:13:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 46709 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 333103858006 for ; Wed, 27 Oct 2021 18:16:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 333103858006 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1635358576; bh=PQOx5M22fQRuq9+rs8aCyBgvUiibA6mRH0JruEUP0qQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=sdQdOftqqK3xpY69sFuB4vkgKUvzeiYNXHN2hCKuDdUkVbMFopkoj+mdAd5gAInXv epI1ff6sCE9IXtybdGzGWIDjWRmssD7elr1M4ZiP9GBVjnQziNKWf7q2nsf48zb6c2 QG16v6DyK395LXBIy+n3kqWud8zCU3QhAh1QIt/U= 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 5C8423858437 for ; Wed, 27 Oct 2021 18:14:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5C8423858437 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-42-zzRREd9TMjml2T24bMyOrw-1; Wed, 27 Oct 2021 14:13:58 -0400 X-MC-Unique: zzRREd9TMjml2T24bMyOrw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DBBDC802B78 for ; Wed, 27 Oct 2021 18:13:57 +0000 (UTC) Received: from abulafia.quesejoda.com (unknown [10.39.192.193]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0DCEA60C21; Wed, 27 Oct 2021 18:13:46 +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 19RIDhGU395812 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 27 Oct 2021 20:13:44 +0200 Received: (from aldyh@localhost) by abulafia.quesejoda.com (8.16.1/8.16.1/Submit) id 19RIDhe0395811; Wed, 27 Oct 2021 20:13:43 +0200 To: GCC patches Subject: [COMMITTED] Kill second order relations in the path solver. Date: Wed, 27 Oct 2021 20:13:21 +0200 Message-Id: <20211027181323.395724-1-aldyh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.0 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" My upcoming work replacing the VRP threaders with a fully resolving backward threader has tripped over various corner cases in the path sensitive relation oracle. This patch kills second order relations when we kill a relation. Tested on x86-64 and ppc64le Linux. Co-authored-by: Andrew MacLeod gcc/ChangeLog: * value-relation.cc (path_oracle::killing_def): Kill second order relations. --- gcc/value-relation.cc | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/gcc/value-relation.cc b/gcc/value-relation.cc index 2acf375ca9a..0ad4f7a9495 100644 --- a/gcc/value-relation.cc +++ b/gcc/value-relation.cc @@ -1297,8 +1297,9 @@ path_oracle::killing_def (tree ssa) fprintf (dump_file, "\n"); } + unsigned v = SSA_NAME_VERSION (ssa); bitmap b = BITMAP_ALLOC (&m_bitmaps); - bitmap_set_bit (b, SSA_NAME_VERSION (ssa)); + bitmap_set_bit (b, v); equiv_chain *ptr = (equiv_chain *) obstack_alloc (&m_chain_obstack, sizeof (equiv_chain)); ptr->m_names = b; @@ -1306,6 +1307,24 @@ path_oracle::killing_def (tree ssa) ptr->m_next = m_equiv.m_next; m_equiv.m_next = ptr; bitmap_ior_into (m_equiv.m_names, b); + + // Walk the relation list an remove SSA from any relations. + if (!bitmap_bit_p (m_relations.m_names, v)) + return; + + bitmap_clear_bit (m_relations.m_names, v); + relation_chain **prev = &(m_relations.m_head); + relation_chain *next = NULL; + for (relation_chain *ptr = m_relations.m_head; ptr; ptr = next) + { + gcc_checking_assert (*prev == ptr); + next = ptr->m_next; + if (SSA_NAME_VERSION (ptr->op1 ()) == v + || SSA_NAME_VERSION (ptr->op2 ()) == v) + *prev = ptr->m_next; + else + prev = &(ptr->m_next); + } } // Register relation K between SSA1 and SSA2, resolving unknowns by