From patchwork Wed Dec 14 15:30:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 131420 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 437CF1007DF for ; Thu, 15 Dec 2011 02:30:43 +1100 (EST) Received: (qmail 13788 invoked by alias); 14 Dec 2011 15:30:38 -0000 Received: (qmail 13768 invoked by uid 22791); 14 Dec 2011 15:30:36 -0000 X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, TW_CF X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 14 Dec 2011 15:30:18 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id A34318ADF6 for ; Wed, 14 Dec 2011 16:30:16 +0100 (CET) Date: Wed, 14 Dec 2011 16:30:16 +0100 (CET) From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR51497 Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 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 This fixes PR51497 by making sure to fixup types that are streamed locally. LTO bootstrapped and tested on x86_64-unknown-linux-gnu, SPEC 2k6 smoke-tested and applied. Richard. 2011-12-14 Richard Guenther PR lto/51497 * lto-streamer-in.c (lto_read_body): Fixup local types TYPE_CANONICAL and variant chain. Index: gcc/lto-streamer-in.c =================================================================== --- gcc/lto-streamer-in.c (revision 182329) +++ gcc/lto-streamer-in.c (working copy) @@ -1012,6 +1012,7 @@ lto_read_body (struct lto_file_decl_data struct function *fn = DECL_STRUCT_FUNCTION (fn_decl); struct lto_in_decl_state *decl_state; struct cgraph_node *node = cgraph_get_node (fn_decl); + unsigned from; gcc_checking_assert (node); push_cfun (fn); @@ -1025,7 +1026,33 @@ lto_read_body (struct lto_file_decl_data input_cfg (&ib_cfg, fn, node->count_materialization_scale); /* Set up the struct function. */ + from = VEC_length (tree, data_in->reader_cache->nodes); input_function (fn_decl, data_in, &ib_main); + /* And fixup types we streamed locally. */ + { + struct streamer_tree_cache_d *cache = data_in->reader_cache; + unsigned len = VEC_length (tree, cache->nodes); + unsigned i; + for (i = len; i-- > from;) + { + tree t = VEC_index (tree, cache->nodes, i); + if (t == NULL_TREE) + continue; + + if (TYPE_P (t)) + { + gcc_assert (TYPE_CANONICAL (t) == NULL_TREE); + TYPE_CANONICAL (t) = TYPE_MAIN_VARIANT (t); + if (TYPE_MAIN_VARIANT (t) != t) + { + gcc_assert (TYPE_NEXT_VARIANT (t) == NULL_TREE); + TYPE_NEXT_VARIANT (t) + = TYPE_NEXT_VARIANT (TYPE_MAIN_VARIANT (t)); + TYPE_NEXT_VARIANT (TYPE_MAIN_VARIANT (t)) = t; + } + } + } + } /* We should now be in SSA. */ cfun->gimple_df->in_ssa_p = true;