aboutsummaryrefslogtreecommitdiff
path: root/gcc
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
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')
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/tree-ssa-loop-ivopts.c15
-rw-r--r--gcc/tree-vect-data-refs.c40
4 files changed, 50 insertions, 21 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5da41db..3d976e5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,19 @@
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.
+
+2010-07-04 Richard Guenther <rguenther@suse.de>
+
PR middle-end/44785
* tree-inline.c (initialize_inlined_parameters): Do not
re-use pointer-map slot over remap_type call.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index f57cd71..299062b 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -2566,7 +2566,7 @@ tree-ssa-loop-ivopts.o : tree-ssa-loop-ivopts.c $(TREE_FLOW_H) $(CONFIG_H) \
$(TREE_PASS_H) $(GGC_H) $(RECOG_H) insn-config.h $(HASHTAB_H) $(SCEV_H) \
$(CFGLOOP_H) $(PARAMS_H) langhooks.h $(BASIC_BLOCK_H) \
tree-affine.h pointer-set.h $(TARGET_H) tree-pretty-print.h \
- gimple-pretty-print.h
+ gimple-pretty-print.h tree-ssa-propagate.h
tree-affine.o : tree-affine.c tree-affine.h $(CONFIG_H) pointer-set.h \
$(SYSTEM_H) $(TREE_H) $(GIMPLE_H) \
output.h $(DIAGNOSTIC_H) coretypes.h $(TREE_DUMP_H) $(FLAGS_H) \
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 02677fa..b7b26a3 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -89,6 +89,7 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "tree-affine.h"
#include "target.h"
+#include "tree-ssa-propagate.h"
/* FIXME: Expressions are expanded to RTL in this pass to determine the
cost of different addressing modes. This should be moved to a TBD
@@ -5481,12 +5482,18 @@ rewrite_use_nonlinear_expr (struct ivopts_data *data,
gcc_unreachable ();
}
- op = force_gimple_operand_gsi (&bsi, comp, false, SSA_NAME_VAR (tgt),
- true, GSI_SAME_STMT);
+ if (!valid_gimple_rhs_p (comp)
+ || (gimple_code (use->stmt) != GIMPLE_PHI
+ /* We can't allow re-allocating the stmt as it might be pointed
+ to still. */
+ && (get_gimple_rhs_num_ops (TREE_CODE (comp))
+ >= gimple_num_ops (gsi_stmt (bsi)))))
+ comp = force_gimple_operand_gsi (&bsi, comp, false, SSA_NAME_VAR (tgt),
+ true, GSI_SAME_STMT);
if (gimple_code (use->stmt) == GIMPLE_PHI)
{
- ass = gimple_build_assign (tgt, op);
+ ass = gimple_build_assign (tgt, comp);
gsi_insert_before (&bsi, ass, GSI_SAME_STMT);
bsi = gsi_for_stmt (use->stmt);
@@ -5494,7 +5501,7 @@ rewrite_use_nonlinear_expr (struct ivopts_data *data,
}
else
{
- gimple_assign_set_rhs_from_tree (&bsi, op);
+ gimple_assign_set_rhs_from_tree (&bsi, comp);
use->stmt = gsi_stmt (bsi);
}
}
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. */