Commit f5d6836a by Richard Guenther Committed by Richard Biener

lto-symtab.c (lto_symtab_merge): Use gimple_types_compatible_p.

2010-07-20  Richard Guenther  <rguenther@suse.de>

	* lto-symtab.c (lto_symtab_merge): Use gimple_types_compatible_p.
	(lto_symtab_merge_decls_2): Likewise.
	* gimple.h (gimple_types_compatible_p): Declare.
	* gimple.c (gimple_queue_type_fixup): Remove.
	(gimple_fixup_complete_and_incomplete_subtype_p): Likewise.
	(gimple_compatible_complete_and_incomplete_type_p): New
	function.
	(gimple_types_compatible_p): Adjust.
	(gimple_register_type): Remove type fixup code.
	(print_gimple_types_stats): Adjust.
	(free_gimple_type_tables): Likewise.
	* lto-streamer-in.c (input_gimple_stmt): Use gimple_types_compatible_p.
	* tree-ssa.c (useless_type_conversion_p): Likewise.

From-SVN: r162330
parent ad650c92
2010-07-20 Richard Guenther <rguenther@suse.de>
* lto-symtab.c (lto_symtab_merge): Use gimple_types_compatible_p.
(lto_symtab_merge_decls_2): Likewise.
* gimple.h (gimple_types_compatible_p): Declare.
* gimple.c (gimple_queue_type_fixup): Remove.
(gimple_fixup_complete_and_incomplete_subtype_p): Likewise.
(gimple_compatible_complete_and_incomplete_type_p): New
function.
(gimple_types_compatible_p): Adjust.
(gimple_register_type): Remove type fixup code.
(print_gimple_types_stats): Adjust.
(free_gimple_type_tables): Likewise.
* lto-streamer-in.c (input_gimple_stmt): Use gimple_types_compatible_p.
* tree-ssa.c (useless_type_conversion_p): Likewise.
2010-07-20 Richard Guenther <rguenther@suse.de>
PR middle-end/44971
PR middle-end/44988
* tree-ssa.c (maybe_optimize_var): New function split out from ...
......
......@@ -956,6 +956,7 @@ extern tree get_call_expr_in (tree t);
extern void recalculate_side_effects (tree);
extern bool gimple_compare_field_offset (tree, tree);
extern tree gimple_register_type (tree);
extern bool gimple_types_compatible_p (tree, tree, bool);
extern void print_gimple_types_stats (void);
extern void free_gimple_type_tables (void);
extern tree gimple_unsigned_type (tree);
......
......@@ -960,7 +960,9 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
{
if (tem == field
|| (TREE_TYPE (tem) == TREE_TYPE (field)
|| (gimple_types_compatible_p (TREE_TYPE (tem),
TREE_TYPE (field),
false)
&& DECL_NONADDRESSABLE_P (tem)
== DECL_NONADDRESSABLE_P (field)
&& gimple_compare_field_offset (tem, field)))
......
......@@ -348,7 +348,8 @@ lto_symtab_merge (lto_symtab_entry_t prevailing, lto_symtab_entry_t entry)
if (TREE_CODE (decl) == FUNCTION_DECL)
{
if (TREE_TYPE (prevailing_decl) != TREE_TYPE (decl))
if (!gimple_types_compatible_p (TREE_TYPE (prevailing_decl),
TREE_TYPE (decl), false))
/* If we don't have a merged type yet...sigh. The linker
wouldn't complain if the types were mismatched, so we
probably shouldn't either. Just use the type from
......@@ -381,7 +382,7 @@ lto_symtab_merge (lto_symtab_entry_t prevailing, lto_symtab_entry_t entry)
fixup process didn't yet run. */
prevailing_type = gimple_register_type (prevailing_type);
type = gimple_register_type (type);
if (prevailing_type != type)
if (!gimple_types_compatible_p (prevailing_type, type, false))
{
if (COMPLETE_TYPE_P (type))
return false;
......@@ -406,7 +407,8 @@ lto_symtab_merge (lto_symtab_entry_t prevailing, lto_symtab_entry_t entry)
if (TREE_CODE (tem1) != TREE_CODE (tem2))
return false;
if (gimple_register_type (tem1) != gimple_register_type (tem2))
if (!gimple_types_compatible_p (gimple_register_type (tem1),
gimple_register_type (tem2), false))
return false;
}
......@@ -600,7 +602,8 @@ lto_symtab_merge_decls_2 (void **slot)
/* Diagnose all mismatched re-declarations. */
for (i = 0; VEC_iterate (tree, mismatches, i, decl); ++i)
{
if (TREE_TYPE (prevailing->decl) != TREE_TYPE (decl))
if (!gimple_types_compatible_p (TREE_TYPE (prevailing->decl),
TREE_TYPE (decl), false))
diagnosed_p |= warning_at (DECL_SOURCE_LOCATION (decl), 0,
"type of %qD does not match original "
"declaration", decl);
......
......@@ -1426,7 +1426,7 @@ useless_type_conversion_p (tree outer_type, tree inner_type)
compared types. */
else if (AGGREGATE_TYPE_P (inner_type)
&& TREE_CODE (inner_type) == TREE_CODE (outer_type))
return false;
return gimple_types_compatible_p (outer_type, inner_type, false);
return false;
}
......
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