From patchwork Wed Oct 26 21:15:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 122010 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id E417C1007D2 for ; Thu, 27 Oct 2011 08:16:15 +1100 (EST) Received: (qmail 24977 invoked by alias); 26 Oct 2011 21:16:13 -0000 Received: (qmail 24967 invoked by uid 22791); 26 Oct 2011 21:16:12 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 26 Oct 2011 21:15:57 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9QLFuL0023112 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 26 Oct 2011 17:15:56 -0400 Received: from houston.quesejoda.com (vpn-236-235.phx2.redhat.com [10.3.236.235]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p9QLFusK014940; Wed, 26 Oct 2011 17:15:56 -0400 Message-ID: <4EA8788B.8030807@redhat.com> Date: Wed, 26 Oct 2011 16:15:55 -0500 From: Aldy Hernandez User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0) Gecko/20110927 Thunderbird/7.0 MIME-Version: 1.0 To: Richard Henderson , gcc-patches , Jakub Jelinek Subject: [trans-mem] fix problems with same body aliases Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org The merge broke base/complete dtor transactional clones that we originally implemented here: http://gcc.gnu.org/ml/gcc-patches/2010-06/msg00590.html First, ipa_tm_execute() was putting __comp_dtor's into tm_callees, which wasn't happening pre-merge. Handling this __comp_dtor caused an ICE tree_function_versioning() because ENTRY_BLOCK_PTR_FOR_FUNCTION is invalid, since the CFG field for the original decl's cfun has not been set. The patch below excludes such aliases from tm_callees since we can't handle them in ipa_tm_create_version. Second, ipa_tm_create_version() marks aliases of the original decl as needed in callback_mark_needed(). Unfortunately, this "needed" bit does not persist until the end of compilation because whole program IPA will remove the bit here: /* Frontends and alias code marks nodes as needed before parsing is finished. We may end up marking as node external nodes where this flag is meaningless strip it. */ if (node->needed && (DECL_EXTERNAL (node->decl) || !node->analyzed)) node->needed = 0; Consequently, the alias will not show up in the .tm_clone_table. The patch below sets the "analyzed" bit to keep this from happening. With it, g++.dg/tm/alias.C works again. No regressions elsewhere. OK? * trans-mem.c (ipa_tm_execute): Do not include aliases in tm_callees. (callback_mark_needed): Set analyzed bit. Index: trans-mem.c =================================================================== --- trans-mem.c (revision 180439) +++ trans-mem.c (working copy) @@ -4137,7 +4137,13 @@ callback_mark_needed (struct cgraph_node record_tm_clone_pair (node->decl, tm_alias); if (info->old_node->needed) - cgraph_mark_needed_node (cgraph_get_node (tm_alias)); + { + struct cgraph_node *alias = cgraph_get_node (tm_alias); + cgraph_mark_needed_node (alias); + /* Needed so function_and_variable_visibility() won't reset + the needed bit. */ + alias->analyzed = 1; + } } return false; } @@ -4592,6 +4598,7 @@ ipa_tm_execute (void) /* For all local functions marked tm_callable, queue them. */ for (node = cgraph_nodes; node; node = node->next) if (is_tm_callable (node->decl) + && !node->alias && cgraph_function_body_availability (node) >= AVAIL_OVERWRITABLE) { d = get_cg_data (node);