From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22329 invoked by alias); 13 Jul 2010 18:56:42 -0000 Received: (qmail 22321 invoked by uid 22791); 13 Jul 2010 18:56:41 -0000 X-SWARE-Spam-Status: No, hits=-5.2 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; Tue, 13 Jul 2010 18:56:35 +0000 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o6DIuXEq010313 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 13 Jul 2010 14:56:33 -0400 Received: from anchor.twiddle.home (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o6DIuWM7031530; Tue, 13 Jul 2010 14:56:32 -0400 Message-ID: <4C3CB6E0.2000000@redhat.com> Date: Tue, 13 Jul 2010 18:56:00 -0000 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Thunderbird/3.0.5 MIME-Version: 1.0 To: IainS CC: GCC Patches , Diego Novillo , Jan Hubicka , Jakub Jelinek Subject: Re: [Patch, updated] Make emulated TLS lto-friendly. References: <4C350C25.2030308@redhat.com> <54190C7D-E4F8-4D84-A468-E38B39770D3F@sandoe-acoustics.co.uk> <4C3624B2.9070602@redhat.com> <4C3B321F.8080507@redhat.com> <4C3B4B00.1070300@redhat.com> <4C3B7623.2020002@redhat.com> <4C3C8A76.2090307@redhat.com> In-Reply-To: <4C3C8A76.2090307@redhat.com> Content-Type: multipart/mixed; boundary="------------080002080908000802070404" X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2010-07/txt/msg01085.txt.bz2 This is a multi-part message in MIME format. --------------080002080908000802070404 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 329 Test #5, delta from #4. Moving the generation of the constructor function from the end of compilation into the IPA pass, while simplifying things generally, revealed to latent bugs: (1) The cdtor generator function failed to zero out all the state. (2) Cgraph failed to run all of the required passes on the new function. r~ --------------080002080908000802070404 Content-Type: text/plain; name="emutls-5" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="emutls-5" Content-length: 1464 diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index da1f983..0d5e792 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -418,12 +418,17 @@ cgraph_process_new_functions (void) push_cfun (DECL_STRUCT_FUNCTION (fndecl)); current_function_decl = fndecl; compute_inline_parameters (node); - if ((cgraph_state == CGRAPH_STATE_IPA_SSA - && !gimple_in_ssa_p (DECL_STRUCT_FUNCTION (fndecl))) - /* When not optimizing, be sure we run early local passes anyway - to expand OMP. */ - || !optimize) + + /* ??? Honza: what's the real difference between IPA and IPA_SSA? + We seem to be assuming that the "real" ipa passes require SSA + but that the "small" ipa passes do not. This is false. Any + new function created by a "small" ipa pass *must* have the + early local passes run so that (at least) init_datastructures + gets executed. Failure to do so results in an immediate crash + once we get to pass_all_optimizations. */ + if (!gimple_in_ssa_p (DECL_STRUCT_FUNCTION (fndecl))) execute_pass_list (pass_early_local_passes.pass.sub); + free_dominance_info (CDI_POST_DOMINATORS); free_dominance_info (CDI_DOMINATORS); pop_cfun (); @@ -2064,7 +2069,9 @@ cgraph_build_static_cdtor (char which, tree body, int priority) cgraph_add_new_function (decl, false); cgraph_mark_needed_node (cgraph_node (decl)); + set_cfun (NULL); + current_function_decl = NULL; } void --------------080002080908000802070404--