aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIra Rosen <irar@gcc.gnu.org>2008-09-10 07:18:52 +0000
committerIra Rosen <irar@gcc.gnu.org>2008-09-10 07:18:52 +0000
commit5392e447a273eca3e6f9a7b9e73c528f42c60a6e (patch)
tree6ce0f40db009a81a6024584a71b687b32f611a99 /gcc
parent4e7f50e5e4100546f2579cc0a8779a5cad4061e2 (diff)
downloadgcc-5392e447a273eca3e6f9a7b9e73c528f42c60a6e.zip
gcc-5392e447a273eca3e6f9a7b9e73c528f42c60a6e.tar.gz
gcc-5392e447a273eca3e6f9a7b9e73c528f42c60a6e.tar.bz2
re PR middle-end/37385 (ICE in set_mem_alias_set with the vectorizer and function pointers)
PR tree-optimization/37385 * tree-vect-transform.c (vect_create_data_ref_ptr): Add a new argument, and use it as a vector type if not NULL. (vectorizable_store): Call vect_create_data_ref_ptr with the type of vectorized rhs. (vect_setup_realignment): Call vect_create_data_ref_ptr with additional argument. (vectorizable_load): Likewise. From-SVN: r140195
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr37385.c20
-rw-r--r--gcc/tree-vect-transform.c16
4 files changed, 47 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 09aaa28..93421f7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2008-09-10 Ira Rosen <irar@il.ibm.com>
+
+ PR tree-optimization/37385
+ * tree-vect-transform.c (vect_create_data_ref_ptr): Add a new argument,
+ and use it as a vector type if not NULL.
+ (vectorizable_store): Call vect_create_data_ref_ptr with the type of
+ vectorized rhs.
+ (vect_setup_realignment): Call vect_create_data_ref_ptr with additional
+ argument.
+ (vectorizable_load): Likewise.
+
2008-09-10 Jakub Jelinek <jakub@redhat.com>
* config/i386/i386.md (SWI32): New mode iterator.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4f1f9e0..b9e4442 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2008-09-10 Martin Michlmayr <tbm@cyrius.com>
+ Ira Rosen <irar@il.ibm.com>
+
+ PR tree-optimization/37385
+ * gcc.dg/vect/pr37385.c: New test.
+
2008-09-09 H.J. Lu <hongjiu.lu@intel.com>
PR rtl-optimization/37435
diff --git a/gcc/testsuite/gcc.dg/vect/pr37385.c b/gcc/testsuite/gcc.dg/vect/pr37385.c
new file mode 100644
index 0000000..d6a477e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr37385.c
@@ -0,0 +1,20 @@
+/* Testcase by Martin Michlmayr <tbm@cyrius.com> */
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+
+typedef int int_t;
+typedef void (*fun_t) (int);
+fun_t fun_tab[400] __attribute__ ((__aligned__(16)));
+
+void foo (int_t a);
+
+void
+bar ()
+{
+ int i;
+
+ for (i = 0; i < 400; i++)
+ fun_tab[i] = foo;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c
index 17f3217..a25960b 100644
--- a/gcc/tree-vect-transform.c
+++ b/gcc/tree-vect-transform.c
@@ -50,7 +50,7 @@ static bool vect_transform_stmt (gimple, gimple_stmt_iterator *, bool *,
slp_tree, slp_instance);
static tree vect_create_destination_var (tree, tree);
static tree vect_create_data_ref_ptr
- (gimple, struct loop*, tree, tree *, gimple *, bool, bool *);
+ (gimple, struct loop*, tree, tree *, gimple *, bool, bool *, tree);
static tree vect_create_addr_base_for_vector_ref
(gimple, gimple_seq *, tree, struct loop *);
static tree vect_get_new_vect_var (tree, enum vect_var_kind, const char *);
@@ -981,6 +981,7 @@ vect_create_addr_base_for_vector_ref (gimple stmt,
by the data-ref in STMT.
4. ONLY_INIT: indicate if vp is to be updated in the loop, or remain
pointing to the initial address.
+ 5. TYPE: if not NULL indicates the required type of the data-ref.
Output:
1. Declare a new ptr to vector_type, and have it point to the base of the
@@ -1010,7 +1011,7 @@ vect_create_addr_base_for_vector_ref (gimple stmt,
static tree
vect_create_data_ref_ptr (gimple stmt, struct loop *at_loop,
tree offset, tree *initial_address, gimple *ptr_incr,
- bool only_init, bool *inv_p)
+ bool only_init, bool *inv_p, tree type)
{
tree base_name;
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
@@ -1069,7 +1070,10 @@ vect_create_data_ref_ptr (gimple stmt, struct loop *at_loop,
}
/** (1) Create the new vector-pointer variable: **/
- vect_ptr_type = build_pointer_type (vectype);
+ if (type)
+ vect_ptr_type = build_pointer_type (type);
+ else
+ vect_ptr_type = build_pointer_type (vectype);
vect_ptr = vect_get_new_vect_var (vect_ptr_type, vect_pointer_var,
get_name (base_name));
@@ -5372,7 +5376,7 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
dataref_ptr = vect_create_data_ref_ptr (first_stmt, NULL, NULL_TREE,
&dummy, &ptr_incr, false,
- &inv_p);
+ &inv_p, TREE_TYPE (vec_oprnd));
gcc_assert (!inv_p);
}
else
@@ -5610,7 +5614,7 @@ vect_setup_realignment (gimple stmt, gimple_stmt_iterator *gsi,
pe = loop_preheader_edge (loop_for_initial_load);
vec_dest = vect_create_destination_var (scalar_dest, vectype);
ptr = vect_create_data_ref_ptr (stmt, loop_for_initial_load, NULL_TREE,
- &init_addr, &inc, true, &inv_p);
+ &init_addr, &inc, true, &inv_p, NULL_TREE);
data_ref = build1 (ALIGN_INDIRECT_REF, vectype, ptr);
new_stmt = gimple_build_assign (vec_dest, data_ref);
new_temp = make_ssa_name (vec_dest, new_stmt);
@@ -6578,7 +6582,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
dataref_ptr = vect_create_data_ref_ptr (first_stmt,
at_loop, offset,
&dummy, &ptr_incr, false,
- &inv_p);
+ &inv_p, NULL_TREE);
else
dataref_ptr =
bump_vector_ptr (dataref_ptr, ptr_incr, gsi, stmt, NULL_TREE);