Commit 200c8750 by Richard Guenther Committed by Richard Biener

lto-symtab.c (lto_symtab_compatible): Fold in ...

2009-10-14  Richard Guenther  <rguenther@suse.de>

	* lto-symtab.c (lto_symtab_compatible): Fold in ...
	(lto_symtab_merge): ... here.  Rewrite both to take the
	prevailing and a to-be-merged entry and to queue diagnostics
	properly.
	(lto_symtab_resolve_replaceable_p): New predicate for
	symbol resolution.
	(lto_symtab_resolve_can_prevail_p): Likewise.
	(lto_symtab_resolve_symbols): Rewrite.  Fold in code that
	handles merging commons by choosing the largest decl.  Fold
	in code that gives ODR errors.
	(lto_symtab_merge_decls_2): Simplify a lot.  Emit queued
	diagnostics here.
	(lto_symtab_merge_decls_1): Re-structure.  Deal with the
	case of no prevailing decl here.  Diagnose mismatches
	in object types here.  Drop all but the prevailing decls.
	(lto_symtab_prevailing_decl): Return the single prevailing decl.
	* lto-streamer-in.c (lto_input_tree_ref): Deal with
	VIEW_CONVERT_EXPRs in decl slots.  Unshare the tree in this case.

	lto/
	* lto.c (lto_fixup_tree): In case the prevailing decl is not
	compatible with the one we replace wrap it around a
	VIEW_CONVERT_EXPR.

From-SVN: r152768
parent 77ce724c
2009-10-14 Richard Guenther <rguenther@suse.de> 2009-10-14 Richard Guenther <rguenther@suse.de>
* lto-symtab.c (lto_symtab_compatible): Fold in ...
(lto_symtab_merge): ... here. Rewrite both to take the
prevailing and a to-be-merged entry and to queue diagnostics
properly.
(lto_symtab_resolve_replaceable_p): New predicate for
symbol resolution.
(lto_symtab_resolve_can_prevail_p): Likewise.
(lto_symtab_resolve_symbols): Rewrite. Fold in code that
handles merging commons by choosing the largest decl. Fold
in code that gives ODR errors.
(lto_symtab_merge_decls_2): Simplify a lot. Emit queued
diagnostics here.
(lto_symtab_merge_decls_1): Re-structure. Deal with the
case of no prevailing decl here. Diagnose mismatches
in object types here. Drop all but the prevailing decls.
(lto_symtab_prevailing_decl): Return the single prevailing decl.
* lto-streamer-in.c (lto_input_tree_ref): Deal with
VIEW_CONVERT_EXPRs in decl slots. Unshare the tree in this case.
2009-10-14 Richard Guenther <rguenther@suse.de>
PR lto/41521 PR lto/41521
* lto-streamer-in.c (input_bb): Replace debug stmts with * lto-streamer-in.c (input_bb): Replace debug stmts with
nops instead of dropping them. nops instead of dropping them.
...@@ -353,7 +353,16 @@ lto_input_tree_ref (struct lto_input_block *ib, struct data_in *data_in, ...@@ -353,7 +353,16 @@ lto_input_tree_ref (struct lto_input_block *ib, struct data_in *data_in,
ix_u = lto_input_uleb128 (ib); ix_u = lto_input_uleb128 (ib);
result = lto_file_decl_data_get_var_decl (data_in->file_data, ix_u); result = lto_file_decl_data_get_var_decl (data_in->file_data, ix_u);
if (tag == LTO_global_decl_ref) if (tag == LTO_global_decl_ref)
varpool_mark_needed_node (varpool_node (result)); {
if (TREE_CODE (result) == VIEW_CONVERT_EXPR)
{
tree decl = TREE_OPERAND (result, 0);
varpool_mark_needed_node (varpool_node (decl));
result = build1 (VIEW_CONVERT_EXPR, TREE_TYPE (result), decl);
}
else
varpool_mark_needed_node (varpool_node (result));
}
break; break;
default: default:
......
2009-10-14 Richard Guenther <rguenther@suse.de>
* lto.c (lto_fixup_tree): In case the prevailing decl is not
compatible with the one we replace wrap it around a
VIEW_CONVERT_EXPR.
2009-10-09 Richard Guenther <rguenther@suse.de> 2009-10-09 Richard Guenther <rguenther@suse.de>
PR lto/41635 PR lto/41635
......
...@@ -1530,10 +1530,18 @@ lto_fixup_tree (tree *tp, int *walk_subtrees, void *data) ...@@ -1530,10 +1530,18 @@ lto_fixup_tree (tree *tp, int *walk_subtrees, void *data)
pointer_set_insert (fixup_data->free_list, t); pointer_set_insert (fixup_data->free_list, t);
/* Replace the decl. If it is a not compatible VAR_DECL wrap
it inside a VIEW_CONVERT_EXPR. */
if (TREE_CODE (*tp) == VAR_DECL
&& !useless_type_conversion_p (TREE_TYPE (*tp),
TREE_TYPE (prevailing)))
*tp = build1 (VIEW_CONVERT_EXPR, TREE_TYPE (*tp), prevailing);
else
*tp = prevailing;
/* Also replace t with prevailing defintion. We don't want to /* Also replace t with prevailing defintion. We don't want to
insert the other defintion in the seen set as we want to insert the other defintion in the seen set as we want to
replace all instances of it. */ replace all instances of it. */
*tp = prevailing;
t = prevailing; t = prevailing;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment