From patchwork Mon Jan 23 17:16:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 137433 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 57EE5B6FBC for ; Tue, 24 Jan 2012 04:16:58 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1327943818; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=x5Domqp yTfOq/hWWLW7HDv52P68=; b=YqLWXu+2VglR64/xqDYu54h+vbCbE8rvlX5GImG IVWVhubLg+Jhv8eZWQBTFWpr6QRcbgjynuI98lMhGWs66Y08wHuEfdKyNZV1bCuw KUh8BOCUQ8Yr4UZc4jHApQZwWrQSTLOjbEosN54aK2vtqrH4fp94kHZa9Jf6G2of hu7w= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=jxZXUWnhgxOCLo5h87+HEMtTISGx+vt/S1b7AOdZlM/Awg0sfmPf1CRFlFJffI SXe8yl0x2CXAjahPa5NCHQj+RqE4beEeAj/sLgnGtWcoSYiKUQo6jPJKxdxMevf3 OTHvlGXubMOynZEIEr9iEG/MvukyptmOS8zfT2n9nrjGs=; Received: (qmail 13945 invoked by alias); 23 Jan 2012 17:16:54 -0000 Received: (qmail 13935 invoked by uid 22791); 23 Jan 2012 17:16:53 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD 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; Mon, 23 Jan 2012 17:16:40 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0NHGeLM003540 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 23 Jan 2012 12:16:40 -0500 Received: from houston.quesejoda.com (vpn-232-218.phx2.redhat.com [10.3.232.218]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q0NHGdBl007566; Mon, 23 Jan 2012 12:16:40 -0500 Message-ID: <4F1D95F7.10801@redhat.com> Date: Mon, 23 Jan 2012 11:16:39 -0600 From: Aldy Hernandez User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: gcc-patches , Richard Henderson Subject: [patch] fix TM clone drops at LTO time 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 While working on PR51698, I've noticed the LTO/TM rabbit hole goes much deeper. The compiler is dropping transactional clones with -flto because the externally_visible bit is unset for clones. This is so because cgraph_copy_node_for_versioning unconditionally zaps it. I have fixed the TM infrastructure to set the bit on the clones if the original version had it set. This patch will be needed to get PR51698 and LTO working with TM. OK? * trans-mem.c (ipa_tm_create_version): Set externally_visible. (ipa_tm_create_version_alias): Same. Index: testsuite/gcc.dg/tm/lto-1.c =================================================================== --- testsuite/gcc.dg/tm/lto-1.c (revision 0) +++ testsuite/gcc.dg/tm/lto-1.c (revision 0) @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-fgnu-tm -flto" } */ + +__attribute__((transaction_safe)) +void foo() +{ +} + +/* { dg-final { scan-assembler "ZGTt3foo" } } */ Index: trans-mem.c =================================================================== --- trans-mem.c (revision 183244) +++ trans-mem.c (working copy) @@ -4221,7 +4221,7 @@ struct create_version_alias_info tree new_decl; }; -/* A subrontine of ipa_tm_create_version, called via +/* A subroutine of ipa_tm_create_version, called via cgraph_for_node_and_aliases. Create new tm clones for each of the existing aliases. */ static bool @@ -4261,6 +4261,7 @@ ipa_tm_create_version_alias (struct cgra new_node = cgraph_same_body_alias (NULL, new_decl, info->new_decl); new_node->tm_clone = true; + new_node->local.externally_visible = info->old_node->local.externally_visible; /* ?? Do not traverse aliases here. */ get_cg_data (&node, false)->clone = new_node; @@ -4296,6 +4297,7 @@ ipa_tm_create_version (struct cgraph_nod DECL_COMDAT_GROUP (new_decl) = tm_mangle (DECL_COMDAT_GROUP (old_decl)); new_node = cgraph_copy_node_for_versioning (old_node, new_decl, NULL, NULL); + new_node->local.externally_visible = old_node->local.externally_visible; new_node->lowered = true; new_node->tm_clone = 1; get_cg_data (&old_node, true)->clone = new_node;