Commit ba6a6a1d by Jan Hubicka Committed by Jan Hubicka

alias.c (get_alias_set): Before checking TYPE_ALIAS_SET_KNOWN_P double check…

alias.c (get_alias_set): Before checking TYPE_ALIAS_SET_KNOWN_P double check that type is main variant.


	* alias.c (get_alias_set): Before checking TYPE_ALIAS_SET_KNOWN_P
	double check that type is main variant.
	* tree.c (build_variant_type_copy): Clear TYPE_ALIAS_SET when producing
	variant.
	(verify_type_variant): Verify that variants have no
	TYPE_ALIAS_SET_KNOWN_P set
	* tree-streamer-out.c (pack_ts_type_common_value_fields): Reorder
	streaming so constant fields come first; stream TYPE_ALIAS_SET==0
	only for main variants; stream TYPE_ALIAS_SET as a bit.
	* tree-streamer-in.c (unpack_ts_type_common_value_fields): Update
	accordingly.

From-SVN: r230838
parent 0b87a9a2
2015-11-24 Jan Hubicka <hubicka@ucw.cz> 2015-11-24 Jan Hubicka <hubicka@ucw.cz>
* alias.c (get_alias_set): Before checking TYPE_ALIAS_SET_KNOWN_P
double check that type is main variant.
* tree.c (build_variant_type_copy): Clear TYPE_ALIAS_SET when producing
variant.
(verify_type_variant): Verify that variants have no
TYPE_ALIAS_SET_KNOWN_P set
* tree-streamer-out.c (pack_ts_type_common_value_fields): Reorder
streaming so constant fields come first; stream TYPE_ALIAS_SET==0
only for main variants; stream TYPE_ALIAS_SET as a bit.
* tree-streamer-in.c (unpack_ts_type_common_value_fields): Update
accordingly.
2015-11-24 Jan Hubicka <hubicka@ucw.cz>
* tree.c (make_vector_type): Properly compute canonical type of the * tree.c (make_vector_type): Properly compute canonical type of the
main variant. main variant.
(verify_type): Verify that TYPE_CANONICAL of TYPE_MAIN_VARIANT is (verify_type): Verify that TYPE_CANONICAL of TYPE_MAIN_VARIANT is
...@@ -888,6 +888,7 @@ get_alias_set (tree t) ...@@ -888,6 +888,7 @@ get_alias_set (tree t)
} }
/* If this is a type with a known alias set, return it. */ /* If this is a type with a known alias set, return it. */
gcc_checking_assert (t == TYPE_MAIN_VARIANT (t));
if (TYPE_ALIAS_SET_KNOWN_P (t)) if (TYPE_ALIAS_SET_KNOWN_P (t))
return TYPE_ALIAS_SET (t); return TYPE_ALIAS_SET (t);
...@@ -1030,6 +1031,7 @@ get_alias_set (tree t) ...@@ -1030,6 +1031,7 @@ get_alias_set (tree t)
We can not call get_alias_set (p) here as that would trigger We can not call get_alias_set (p) here as that would trigger
infinite recursion when p == t. In other cases it would just infinite recursion when p == t. In other cases it would just
trigger unnecesary legwork of rebuilding the pointer again. */ trigger unnecesary legwork of rebuilding the pointer again. */
gcc_checking_assert (p == TYPE_MAIN_VARIANT (p));
if (TYPE_ALIAS_SET_KNOWN_P (p)) if (TYPE_ALIAS_SET_KNOWN_P (p))
set = TYPE_ALIAS_SET (p); set = TYPE_ALIAS_SET (p);
else else
......
...@@ -362,6 +362,11 @@ unpack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr) ...@@ -362,6 +362,11 @@ unpack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr)
/* TYPE_NO_FORCE_BLK is private to stor-layout and need /* TYPE_NO_FORCE_BLK is private to stor-layout and need
no streaming. */ no streaming. */
TYPE_NEEDS_CONSTRUCTING (expr) = (unsigned) bp_unpack_value (bp, 1); TYPE_NEEDS_CONSTRUCTING (expr) = (unsigned) bp_unpack_value (bp, 1);
TYPE_PACKED (expr) = (unsigned) bp_unpack_value (bp, 1);
TYPE_RESTRICT (expr) = (unsigned) bp_unpack_value (bp, 1);
TYPE_USER_ALIGN (expr) = (unsigned) bp_unpack_value (bp, 1);
TYPE_READONLY (expr) = (unsigned) bp_unpack_value (bp, 1);
TYPE_ALIAS_SET (expr) = bp_unpack_value (bp, 1) ? 0 : -1;
if (RECORD_OR_UNION_TYPE_P (expr)) if (RECORD_OR_UNION_TYPE_P (expr))
{ {
TYPE_TRANSPARENT_AGGR (expr) = (unsigned) bp_unpack_value (bp, 1); TYPE_TRANSPARENT_AGGR (expr) = (unsigned) bp_unpack_value (bp, 1);
...@@ -369,17 +374,12 @@ unpack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr) ...@@ -369,17 +374,12 @@ unpack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr)
} }
else if (TREE_CODE (expr) == ARRAY_TYPE) else if (TREE_CODE (expr) == ARRAY_TYPE)
TYPE_NONALIASED_COMPONENT (expr) = (unsigned) bp_unpack_value (bp, 1); TYPE_NONALIASED_COMPONENT (expr) = (unsigned) bp_unpack_value (bp, 1);
TYPE_PACKED (expr) = (unsigned) bp_unpack_value (bp, 1);
TYPE_RESTRICT (expr) = (unsigned) bp_unpack_value (bp, 1);
TYPE_USER_ALIGN (expr) = (unsigned) bp_unpack_value (bp, 1);
TYPE_READONLY (expr) = (unsigned) bp_unpack_value (bp, 1);
TYPE_PRECISION (expr) = bp_unpack_var_len_unsigned (bp); TYPE_PRECISION (expr) = bp_unpack_var_len_unsigned (bp);
TYPE_ALIGN (expr) = bp_unpack_var_len_unsigned (bp); TYPE_ALIGN (expr) = bp_unpack_var_len_unsigned (bp);
#ifdef ACCEL_COMPILER #ifdef ACCEL_COMPILER
if (TYPE_ALIGN (expr) > targetm.absolute_biggest_alignment) if (TYPE_ALIGN (expr) > targetm.absolute_biggest_alignment)
TYPE_ALIGN (expr) = targetm.absolute_biggest_alignment; TYPE_ALIGN (expr) = targetm.absolute_biggest_alignment;
#endif #endif
TYPE_ALIAS_SET (expr) = bp_unpack_var_len_int (bp);
} }
......
...@@ -313,6 +313,17 @@ pack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr) ...@@ -313,6 +313,17 @@ pack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr)
/* TYPE_NO_FORCE_BLK is private to stor-layout and need /* TYPE_NO_FORCE_BLK is private to stor-layout and need
no streaming. */ no streaming. */
bp_pack_value (bp, TYPE_NEEDS_CONSTRUCTING (expr), 1); bp_pack_value (bp, TYPE_NEEDS_CONSTRUCTING (expr), 1);
bp_pack_value (bp, TYPE_PACKED (expr), 1);
bp_pack_value (bp, TYPE_RESTRICT (expr), 1);
bp_pack_value (bp, TYPE_USER_ALIGN (expr), 1);
bp_pack_value (bp, TYPE_READONLY (expr), 1);
/* Make sure to preserve the fact whether the frontend would assign
alias-set zero to this type. Do that only for main variants, because
type variants alias sets are never computed.
FIXME: This does not work for pre-streamed builtin types. */
bp_pack_value (bp, (TYPE_ALIAS_SET (expr) == 0
|| (!in_lto_p && TYPE_MAIN_VARIANT (expr) == expr
&& get_alias_set (expr) == 0)), 1);
if (RECORD_OR_UNION_TYPE_P (expr)) if (RECORD_OR_UNION_TYPE_P (expr))
{ {
bp_pack_value (bp, TYPE_TRANSPARENT_AGGR (expr), 1); bp_pack_value (bp, TYPE_TRANSPARENT_AGGR (expr), 1);
...@@ -320,17 +331,8 @@ pack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr) ...@@ -320,17 +331,8 @@ pack_ts_type_common_value_fields (struct bitpack_d *bp, tree expr)
} }
else if (TREE_CODE (expr) == ARRAY_TYPE) else if (TREE_CODE (expr) == ARRAY_TYPE)
bp_pack_value (bp, TYPE_NONALIASED_COMPONENT (expr), 1); bp_pack_value (bp, TYPE_NONALIASED_COMPONENT (expr), 1);
bp_pack_value (bp, TYPE_PACKED (expr), 1);
bp_pack_value (bp, TYPE_RESTRICT (expr), 1);
bp_pack_value (bp, TYPE_USER_ALIGN (expr), 1);
bp_pack_value (bp, TYPE_READONLY (expr), 1);
bp_pack_var_len_unsigned (bp, TYPE_PRECISION (expr)); bp_pack_var_len_unsigned (bp, TYPE_PRECISION (expr));
bp_pack_var_len_unsigned (bp, TYPE_ALIGN (expr)); bp_pack_var_len_unsigned (bp, TYPE_ALIGN (expr));
/* Make sure to preserve the fact whether the frontend would assign
alias-set zero to this type. */
bp_pack_var_len_int (bp, (TYPE_ALIAS_SET (expr) == 0
|| (!in_lto_p
&& get_alias_set (expr) == 0)) ? 0 : -1);
} }
......
...@@ -6727,6 +6727,8 @@ build_variant_type_copy (tree type) ...@@ -6727,6 +6727,8 @@ build_variant_type_copy (tree type)
/* Since we're building a variant, assume that it is a non-semantic /* Since we're building a variant, assume that it is a non-semantic
variant. This also propagates TYPE_STRUCTURAL_EQUALITY_P. */ variant. This also propagates TYPE_STRUCTURAL_EQUALITY_P. */
TYPE_CANONICAL (t) = TYPE_CANONICAL (type); TYPE_CANONICAL (t) = TYPE_CANONICAL (type);
/* Type variants have no alias set defined. */
TYPE_ALIAS_SET (t) = -1;
/* Add the new type to the chain of variants of TYPE. */ /* Add the new type to the chain of variants of TYPE. */
TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m); TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m);
...@@ -13074,8 +13076,12 @@ verify_type_variant (const_tree t, tree tv) ...@@ -13074,8 +13076,12 @@ verify_type_variant (const_tree t, tree tv)
if ((!in_lto_p || !TYPE_FILE_SCOPE_P (t)) && 0) if ((!in_lto_p || !TYPE_FILE_SCOPE_P (t)) && 0)
verify_variant_match (TYPE_CONTEXT); verify_variant_match (TYPE_CONTEXT);
verify_variant_match (TYPE_STRING_FLAG); verify_variant_match (TYPE_STRING_FLAG);
if (TYPE_ALIAS_SET_KNOWN_P (t) && TYPE_ALIAS_SET_KNOWN_P (tv)) if (TYPE_ALIAS_SET_KNOWN_P (t))
verify_variant_match (TYPE_ALIAS_SET); {
error ("type variant with TYPE_ALIAS_SET_KNOWN_P");
debug_tree (tv);
return false;
}
/* tree_type_non_common checks. */ /* tree_type_non_common checks. */
......
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