Commit 907dd6ae by Richard Guenther Committed by Richard Biener

tree.c (make_vector_type): Build a main variant first, get the canonical one and…

tree.c (make_vector_type): Build a main variant first, get the canonical one and then build the variant.

2009-08-03  Richard Guenther  <rguenther@suse.de>

	* tree.c (make_vector_type): Build a main variant first,
	get the canonical one and then build the variant.
	* tree-ssa.c (useless_type_conversion_p_1): Handle
	fixed-point types.
	(useless_type_conversion_p): Conversions to pointers to
	incomplete record types are useless.

From-SVN: r150370
parent 2329c6f5
2009-08-03 Richard Guenther <rguenther@suse.de>
* tree.c (make_vector_type): Build a main variant first,
get the canonical one and then build the variant.
* tree-ssa.c (useless_type_conversion_p_1): Handle
fixed-point types.
(useless_type_conversion_p): Conversions to pointers to
incomplete record types are useless.
2009-08-03 Richard Guenther <rguenther@suse.de>
* tree-cfg.c (pass_warn_unused_result): Mark name that no dump
file will be created.
* omp-low.c (pass_diagnose_omp_blocks): Likewise.
......
......@@ -897,6 +897,11 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type)
&& SCALAR_FLOAT_TYPE_P (outer_type))
return true;
/* Fixed point types with the same mode are compatible. */
else if (FIXED_POINT_TYPE_P (inner_type)
&& FIXED_POINT_TYPE_P (outer_type))
return true;
/* We need to take special care recursing to pointed-to types. */
else if (POINTER_TYPE_P (inner_type)
&& POINTER_TYPE_P (outer_type))
......@@ -1000,12 +1005,17 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type)
bool
useless_type_conversion_p (tree outer_type, tree inner_type)
{
/* If the outer type is (void *), then the conversion is not
necessary. We have to make sure to not apply this while
recursing though. */
/* If the outer type is (void *) or a pointer to an incomplete record type,
then the conversion is not necessary.
We have to make sure to not apply this while recursing though. */
if (POINTER_TYPE_P (inner_type)
&& POINTER_TYPE_P (outer_type)
&& TREE_CODE (TREE_TYPE (outer_type)) == VOID_TYPE)
&& (VOID_TYPE_P (TREE_TYPE (outer_type))
|| (AGGREGATE_TYPE_P (TREE_TYPE (outer_type))
&& TREE_CODE (TREE_TYPE (outer_type)) != ARRAY_TYPE
&& (TREE_CODE (TREE_TYPE (outer_type))
== TREE_CODE (TREE_TYPE (inner_type)))
&& !COMPLETE_TYPE_P (TREE_TYPE (outer_type)))))
return true;
return useless_type_conversion_p_1 (outer_type, inner_type);
......
......@@ -7686,21 +7686,10 @@ make_vector_type (tree innertype, int nunits, enum machine_mode mode)
tree t;
hashval_t hashcode = 0;
/* Build a main variant, based on the main variant of the inner type, then
use it to build the variant we return. */
if ((TYPE_ATTRIBUTES (innertype) || TYPE_QUALS (innertype))
&& TYPE_MAIN_VARIANT (innertype) != innertype)
return build_type_attribute_qual_variant (
make_vector_type (TYPE_MAIN_VARIANT (innertype), nunits, mode),
TYPE_ATTRIBUTES (innertype),
TYPE_QUALS (innertype));
t = make_node (VECTOR_TYPE);
TREE_TYPE (t) = TYPE_MAIN_VARIANT (innertype);
SET_TYPE_VECTOR_SUBPARTS (t, nunits);
SET_TYPE_MODE (t, mode);
TYPE_READONLY (t) = TYPE_READONLY (innertype);
TYPE_VOLATILE (t) = TYPE_VOLATILE (innertype);
if (TYPE_STRUCTURAL_EQUALITY_P (innertype))
SET_TYPE_STRUCTURAL_EQUALITY (t);
......@@ -7730,9 +7719,20 @@ make_vector_type (tree innertype, int nunits, enum machine_mode mode)
}
hashcode = iterative_hash_host_wide_int (VECTOR_TYPE, hashcode);
hashcode = iterative_hash_host_wide_int (nunits, hashcode);
hashcode = iterative_hash_host_wide_int (mode, hashcode);
hashcode = iterative_hash_object (TYPE_HASH (innertype), hashcode);
return type_hash_canon (hashcode, t);
hashcode = iterative_hash_object (TYPE_HASH (TREE_TYPE (t)), hashcode);
t = type_hash_canon (hashcode, t);
/* We have built a main variant, based on the main variant of the
inner type. Use it to build the variant we return. */
if ((TYPE_ATTRIBUTES (innertype) || TYPE_QUALS (innertype))
&& TREE_TYPE (t) != innertype)
return build_type_attribute_qual_variant (t,
TYPE_ATTRIBUTES (innertype),
TYPE_QUALS (innertype));
return t;
}
static tree
......
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