From patchwork Wed Jun 12 14:43:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 250805 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 "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 11B182C008F for ; Thu, 13 Jun 2013 00:43:31 +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=qqlEHPKkAGawuqxYtTIiFErYpx5n7+eTtfEtXb1J5kz7xZmF49Uz8 dttPhlmjfjxCQYFHhZ8ps5+hVL5fcM4eid6rFa6RcvVVgrSQjP2Kr71552jKXnq6 LdDTh/IINHiHfSUXcYf9r17xAPpaByWXTjoJwX9T96/YnJKcy5aQVs= 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=ZqatwpHAQ0Dw/xfTYUT0K9UXdRY=; b=MN6ysUffY5VjyKWdKUmf scpLAS1vYJ7yleDQUrAYE7qiSVpAVr7C4NJ2xW+kKYojrcJO7ujh3CE67MsfQppe dqe0aA3Ob7xwnn7OuBTrHf8U+m1hwpEWOZlpSwPo8/dtKflpWecCbplmN9YrW8L4 IwdztuPwb+QWr7LH5o72Gs4= Received: (qmail 3133 invoked by alias); 12 Jun 2013 14:43:25 -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 3120 invoked by uid 89); 12 Jun 2013 14:43:23 -0000 X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL, BAYES_00, KAM_STOCKTIP, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD autolearn=no version=3.3.1 Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 12 Jun 2013 14:43:21 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 74B53541C2D; Wed, 12 Jun 2013 16:43:19 +0200 (CEST) Date: Wed, 12 Jun 2013 16:43:19 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Fix verifier for duplicated decls during sreaming Message-ID: <20130612144319.GF24302@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Hi, verifier needs update to tolerate duplicated nodes for a decl during LTO streaming state. Bootstrapped/regtested x86_64-linux, comitted. Honza * cgraph.c (verify_edge_corresponds_to_fndecl): Be lax about decl has when in streaming stage. * lto-symtab.c (lto_symtab_merge_symbols): Likewise. * cgraph.h (cgraph_state): Add CGRAPH_LTO_STREAMING. * lto.c (read_cgraph_and_symbols): Set cgraph into streaming state. Index: cgraph.c =================================================================== --- cgraph.c (revision 199991) +++ cgraph.c (working copy) @@ -2291,6 +2291,8 @@ verify_edge_corresponds_to_fndecl (struc if (!decl || e->callee->global.inlined_to) return false; + if (cgraph_state == CGRAPH_LTO_STREAMING) + return false; node = cgraph_get_node (decl); /* We do not know if a node from a different partition is an alias or what it Index: cgraph.h =================================================================== --- cgraph.h (revision 199991) +++ cgraph.h (working copy) @@ -551,6 +551,8 @@ enum cgraph_state CGRAPH_STATE_PARSING, /* Callgraph is being constructed. It is safe to add new functions. */ CGRAPH_STATE_CONSTRUCTION, + /* Callgraph is being at LTO time. */ + CGRAPH_LTO_STREAMING, /* Callgraph is built and IPA passes are being run. */ CGRAPH_STATE_IPA, /* Callgraph is built and all functions are transformed to SSA form. */ Index: lto/lto.c =================================================================== --- lto/lto.c (revision 199991) +++ lto/lto.c (working copy) @@ -2891,6 +2891,7 @@ read_cgraph_and_symbols (unsigned nfiles /* True, since the plugin splits the archives. */ gcc_assert (num_objects == nfiles); } + cgraph_state = CGRAPH_LTO_STREAMING; tree_with_vars = htab_create_ggc (101, htab_hash_pointer, htab_eq_pointer, NULL); Index: lto-symtab.c =================================================================== --- lto-symtab.c (revision 199991) +++ lto-symtab.c (working copy) @@ -587,7 +587,7 @@ lto_symtab_merge_symbols (void) also re-populate the hash translating decls into symtab nodes*/ FOR_EACH_SYMBOL (node) { - cgraph_node *cnode; + cgraph_node *cnode, *cnode2; if (!node->symbol.analyzed && node->symbol.alias_target) { symtab_node tgt = symtab_node_for_asm (node->symbol.alias_target); @@ -596,10 +596,17 @@ lto_symtab_merge_symbols (void) symtab_resolve_alias (node, tgt); } node->symbol.aux = NULL; + if (!(cnode = dyn_cast (node)) || !cnode->clone_of || cnode->clone_of->symbol.decl != cnode->symbol.decl) - symtab_insert_node_to_hashtable ((symtab_node)node); + { + if (cnode && DECL_BUILT_IN (node->symbol.decl) + && (cnode2 = cgraph_get_node (node->symbol.decl)) + && cnode2 != cnode) + lto_cgraph_replace_node (cnode2, cnode); + symtab_insert_node_to_hashtable ((symtab_node)node); + } } } } Index: symtab.c =================================================================== --- symtab.c (revision 199991) +++ symtab.c (working copy) @@ -647,11 +647,14 @@ verify_symtab_base (symtab_node node) error_found = true; } - hashed_node = symtab_get_node (node->symbol.decl); - if (!hashed_node) + if (cgraph_state != CGRAPH_LTO_STREAMING) { - error ("node not found in symtab decl hashtable"); - error_found = true; + hashed_node = symtab_get_node (node->symbol.decl); + if (!hashed_node) + { + error ("node not found in symtab decl hashtable"); + error_found = true; + } } if (assembler_name_hash) {