From patchwork Sat Sep 7 08:04:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 273374 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "www.sourceware.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by ozlabs.org (Postfix) with ESMTPS id A9C7E2C0103 for ; Sat, 7 Sep 2013 18:05:04 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=s4sHaLQVqHJEj9smx3Eo3cbEWDQDSCUzuHCuaCQF70UXNChoPWPg3 mGlotgiNYMwCwOvzU3s3QgLiwzjYMj5aPW+cM+bl0CneH9jKapyEjXy72Wetb6OG gE4i0qnpA/nD0/6d2ln4uOczc2gLIG+2alnqKuDE5JhiIeipY5WC8U= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=I+ig2VGv/XPBeRg7uKPkwJ83oW0=; b=SuxgNwkI5nMmaI/Le5Oo 2jWIO8QT81bsPKXPHpSyMhrNFtVsIHFQ1Y0hG0/8yNyMjT0Vydy+YiSfPMxjYfYv GpSKrhVQ1riL9mFhD2lC9A+UNVxF1Pup2gwYs11f6Z5uLjNt2MRoSv1MQWdDSLor NIEzGIXRMNNvmTdXN1DTpM8= Received: (qmail 4003 invoked by alias); 7 Sep 2013 08:04:58 -0000 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 Received: (qmail 3994 invoked by uid 89); 7 Sep 2013 08:04:57 -0000 Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Sat, 07 Sep 2013 08:04:57 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, NO_RELAYS autolearn=ham version=3.3.2 X-HELO: nikam.ms.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 541E3543A04; Sat, 7 Sep 2013 10:04:53 +0200 (CEST) Date: Sat, 7 Sep 2013 10:04:53 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Fix gimple thunks Message-ID: <20130907080453.GB8074@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Hi, this is a variant of patch I tested and comitted after discussion on DECL_ARGUMENTS change. Basically ARGUMENTS are now part of a functio nbody and we need to stream them for thunks in order to be able to expand them. The patch also fixes misplaced pop_cfun in lto-streamer-in.c. Bootstrapped/regtested x86_64-linux, comitted. * cgraphunit.c (expand_thunk): Get body before touching arguments. * lto-streamer-out.c: Stream thunks, too. * lto-streamer-in.c (input_function): Pop cfun here (lto_read_body): Instead of here. Index: cgraphunit.c =================================================================== --- cgraphunit.c (revision 202335) +++ cgraphunit.c (working copy) @@ -1433,7 +1433,11 @@ expand_thunk (struct cgraph_node *node) tree virtual_offset = NULL; tree alias = node->callees->callee->symbol.decl; tree thunk_fndecl = node->symbol.decl; - tree a = DECL_ARGUMENTS (thunk_fndecl); + tree a; + + if (in_lto_p) + cgraph_get_body (node); + a = DECL_ARGUMENTS (thunk_fndecl); current_function_decl = thunk_fndecl; Index: lto-streamer-out.c =================================================================== --- lto-streamer-out.c (revision 202335) +++ lto-streamer-out.c (working copy) @@ -1985,8 +1985,7 @@ lto_output (void) cgraph_node *node = dyn_cast (snode); if (node && lto_symtab_encoder_encode_body_p (encoder, node) - && !node->symbol.alias - && !node->thunk.thunk_p) + && !node->symbol.alias) { #ifdef ENABLE_CHECKING gcc_assert (!bitmap_bit_p (output, DECL_UID (node->symbol.decl))); Index: lto-streamer-in.c =================================================================== --- lto-streamer-in.c (revision 202335) +++ lto-streamer-in.c (working copy) @@ -998,6 +998,7 @@ input_function (tree fn_decl, struct dat free_dominance_info (CDI_DOMINATORS); free_dominance_info (CDI_POST_DOMINATORS); free (stmts); + pop_cfun (); } @@ -1086,8 +1087,6 @@ lto_read_body (struct lto_file_decl_data /* Restore decl state */ file_data->current_decl_state = file_data->global_decl_state; - - pop_cfun (); } lto_data_in_delete (data_in);