diff options
author | Richard Guenther <rguenther@suse.de> | 2008-09-17 11:42:11 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2008-09-17 11:42:11 +0000 |
commit | 791f17147f98a1bdd8be36d677272c57ce933196 (patch) | |
tree | 7a9cca363d997be715d76fb169665299d0a9b318 /gcc | |
parent | 03e74118561be5f560dad6c09836d93b9f77205d (diff) | |
download | gcc-791f17147f98a1bdd8be36d677272c57ce933196.zip gcc-791f17147f98a1bdd8be36d677272c57ce933196.tar.gz gcc-791f17147f98a1bdd8be36d677272c57ce933196.tar.bz2 |
re PR middle-end/37385 (ICE in set_mem_alias_set with the vectorizer and function pointers)
2008-09-17 Richard Guenther <rguenther@suse.de>
PR middle-end/37385
PR tree-optimization/37491
* alias.c (get_alias_set): Use the canonical type.
* tree-vect-transform.c (vectorizable_store): Use the type of
the lhs for the vector type. Adjust checking.
(vectorizable_load): Adjust checking.
From-SVN: r140412
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/alias.c | 5 | ||||
-rw-r--r-- | gcc/tree-vect-transform.c | 43 |
3 files changed, 40 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e6238c2..fcabf71 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2008-09-17 Richard Guenther <rguenther@suse.de> + + PR middle-end/37385 + PR tree-optimization/37491 + * alias.c (get_alias_set): Use the canonical type. + * tree-vect-transform.c (vectorizable_store): Use the type of + the lhs for the vector type. Adjust checking. + (vectorizable_load): Adjust checking. + 2008-09-16 Jakub Jelinek <jakub@redhat.com> Adam Nemet <anemet@caviumnetworks.com> diff --git a/gcc/alias.c b/gcc/alias.c index 56660ec..35a40bc 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -604,8 +604,11 @@ get_alias_set (tree t) } /* Variant qualifiers don't affect the alias set, so get the main - variant. If this is a type with a known alias set, return it. */ + variant. Always use the canonical type as well. + If this is a type with a known alias set, return it. */ t = TYPE_MAIN_VARIANT (t); + if (TYPE_CANONICAL (t)) + t = TYPE_CANONICAL (t); if (TYPE_ALIAS_SET_KNOWN_P (t)) return TYPE_ALIAS_SET (t); diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c index d69ce51..06d6791 100644 --- a/gcc/tree-vect-transform.c +++ b/gcc/tree-vect-transform.c @@ -5182,24 +5182,23 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, return false; } - /* The type of the vector store is determined by the rhs. */ - vectype = get_vectype_for_scalar_type (TREE_TYPE (op)); - /* If accesses through a pointer to vectype do not alias the original - memory reference we have a problem. */ - if (get_alias_set (vectype) != get_alias_set (TREE_TYPE (scalar_dest)) + memory reference we have a problem. This should never be the case. */ + if (get_alias_set (vectype) != get_alias_set (scalar_dest) && !alias_set_subset_of (get_alias_set (vectype), - get_alias_set (TREE_TYPE (scalar_dest)))) + get_alias_set (scalar_dest))) { if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "vector type does not alias scalar type"); + fprintf (vect_dump, "??? vector type does not alias scalar type"); return false; } - if (!useless_type_conversion_p (TREE_TYPE (op), TREE_TYPE (scalar_dest))) + /* The scalar rhs type needs to be trivially convertible to the vector + component type. This should always be the case. */ + if (!useless_type_conversion_p (TREE_TYPE (vectype), TREE_TYPE (op))) { if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "operands of different types"); + fprintf (vect_dump, "??? operands of different types"); return false; } @@ -5367,8 +5366,8 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, Therefore, NEXT_STMT can't be NULL_TREE. In case that there is no interleaving, GROUP_SIZE is 1, and only one iteration of the loop will be executed. */ - gcc_assert (next_stmt); - gcc_assert (gimple_assign_single_p (next_stmt)); + gcc_assert (next_stmt + && gimple_assign_single_p (next_stmt)); op = gimple_assign_rhs1 (next_stmt); vec_oprnd = vect_get_vec_def_for_operand (op, next_stmt, @@ -5379,9 +5378,12 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, } } + /* We should have catched mismatched types earlier. */ + gcc_assert (useless_type_conversion_p (vectype, + TREE_TYPE (vec_oprnd))); dataref_ptr = vect_create_data_ref_ptr (first_stmt, NULL, NULL_TREE, &dummy, &ptr_incr, false, - &inv_p, TREE_TYPE (vec_oprnd)); + &inv_p, NULL); gcc_assert (!inv_p); } else @@ -6384,13 +6386,22 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, } /* If accesses through a pointer to vectype do not alias the original - memory reference we have a problem. */ - if (get_alias_set (vectype) != get_alias_set (scalar_type) + memory reference we have a problem. This should never happen. */ + if (get_alias_set (vectype) != get_alias_set (gimple_assign_rhs1 (stmt)) && !alias_set_subset_of (get_alias_set (vectype), - get_alias_set (scalar_type))) + get_alias_set (gimple_assign_rhs1 (stmt)))) { if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "vector type does not alias scalar type"); + fprintf (vect_dump, "??? vector type does not alias scalar type"); + return false; + } + + /* The vector component type needs to be trivially convertible to the + scalar lhs. This should always be the case. */ + if (!useless_type_conversion_p (TREE_TYPE (scalar_dest), TREE_TYPE (vectype))) + { + if (vect_print_dump_info (REPORT_DETAILS)) + fprintf (vect_dump, "??? operands of different types"); return false; } |