Fix verifier for duplicated decls during sreaming
Jan Hubicka
hubicka@ucw.cz
Wed Jun 12 14:43:00 GMT 2013
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 <cgraph_node> (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)
{
More information about the Gcc-patches
mailing list