aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-data-refs.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-07-04 16:08:21 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-07-04 16:08:21 +0000
commit17fc049f3443386e244e5be2274f507809153634 (patch)
tree59e80ed510f8ae3365e1b7da08565e3b031f12d9 /gcc/tree-vect-data-refs.c
parentc9dfc4144a464f1ee0306ff388ee85e2c178f18c (diff)
downloadgcc-17fc049f3443386e244e5be2274f507809153634.zip
gcc-17fc049f3443386e244e5be2274f507809153634.tar.gz
gcc-17fc049f3443386e244e5be2274f507809153634.tar.bz2
re PR rtl-optimization/44479 (false dependencies are computed after vectorization)
2010-07-04 Richard Guenther <rguenther@suse.de> PR tree-optimization/44479 * tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Avoid extra SSA name copy statements which preserves points-to information. * tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Copy points-to information for all pointers. Properly handle MEM_REFs. (vect_create_data_ref_ptr): Likewise. Avoid extra SSA name copy statements. * Makefile.in (tree-ssa-loop-ivopts.o): Add tree-ssa-propagate.h dependency. From-SVN: r161802
Diffstat (limited to 'gcc/tree-vect-data-refs.c')
-rw-r--r--gcc/tree-vect-data-refs.c40
1 files changed, 24 insertions, 16 deletions
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index cf9fab2..629450c 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -2787,7 +2787,7 @@ vect_create_addr_base_for_vector_ref (gimple stmt,
vect_ptr_type = build_pointer_type (STMT_VINFO_VECTYPE (stmt_info));
base = get_base_address (DR_REF (dr));
if (base
- && INDIRECT_REF_P (base))
+ && TREE_CODE (base) == MEM_REF)
vect_ptr_type
= build_qualified_type (vect_ptr_type,
TYPE_QUALS (TREE_TYPE (TREE_OPERAND (base, 0))));
@@ -2799,6 +2799,10 @@ vect_create_addr_base_for_vector_ref (gimple stmt,
vec_stmt = force_gimple_operand (vec_stmt, &seq, false, addr_expr);
gimple_seq_add_seq (new_stmt_list, seq);
+ if (DR_PTR_INFO (dr)
+ && TREE_CODE (vec_stmt) == SSA_NAME)
+ duplicate_ssa_name_ptr_info (vec_stmt, DR_PTR_INFO (dr));
+
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "created ");
@@ -2934,7 +2938,7 @@ vect_create_data_ref_ptr (gimple stmt, struct loop *at_loop,
vect_ptr_type = build_pointer_type (vectype);
base = get_base_address (DR_REF (dr));
if (base
- && INDIRECT_REF_P (base))
+ && TREE_CODE (base) == MEM_REF)
vect_ptr_type
= build_qualified_type (vect_ptr_type,
TYPE_QUALS (TREE_TYPE (TREE_OPERAND (base, 0))));
@@ -3032,17 +3036,26 @@ vect_create_data_ref_ptr (gimple stmt, struct loop *at_loop,
*initial_address = new_temp;
/* Create: p = (vectype *) initial_base */
- vec_stmt = gimple_build_assign (vect_ptr,
- fold_convert (vect_ptr_type, new_temp));
- vect_ptr_init = make_ssa_name (vect_ptr, vec_stmt);
- gimple_assign_set_lhs (vec_stmt, vect_ptr_init);
- if (pe)
+ if (TREE_CODE (new_temp) != SSA_NAME
+ || !useless_type_conversion_p (vect_ptr_type, TREE_TYPE (new_temp)))
{
- new_bb = gsi_insert_on_edge_immediate (pe, vec_stmt);
- gcc_assert (!new_bb);
+ vec_stmt = gimple_build_assign (vect_ptr,
+ fold_convert (vect_ptr_type, new_temp));
+ vect_ptr_init = make_ssa_name (vect_ptr, vec_stmt);
+ /* Copy the points-to information if it exists. */
+ if (DR_PTR_INFO (dr))
+ duplicate_ssa_name_ptr_info (vect_ptr_init, DR_PTR_INFO (dr));
+ gimple_assign_set_lhs (vec_stmt, vect_ptr_init);
+ if (pe)
+ {
+ new_bb = gsi_insert_on_edge_immediate (pe, vec_stmt);
+ gcc_assert (!new_bb);
+ }
+ else
+ gsi_insert_before (&gsi, vec_stmt, GSI_SAME_STMT);
}
else
- gsi_insert_before (&gsi, vec_stmt, GSI_SAME_STMT);
+ vect_ptr_init = new_temp;
/** (4) Handle the updating of the vector-pointer inside the loop.
This is needed when ONLY_INIT is false, and also when AT_LOOP
@@ -3051,12 +3064,7 @@ vect_create_data_ref_ptr (gimple stmt, struct loop *at_loop,
/* No update in loop is required. */
if (only_init && (!loop_vinfo || at_loop == loop))
- {
- /* Copy the points-to information if it exists. */
- if (DR_PTR_INFO (dr))
- duplicate_ssa_name_ptr_info (vect_ptr_init, DR_PTR_INFO (dr));
- vptr = vect_ptr_init;
- }
+ vptr = vect_ptr_init;
else
{
/* The step of the vector pointer is the Vector Size. */