summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKeith Besaw <kbesaw@us.ibm.com>2005-05-29 13:14:42 +0000
committerDorit Nuzman <dorit@gcc.gnu.org>2005-05-29 13:14:42 +0000
commit9cf5a7e38d9098ce4961b091f70c40e8eb287e65 (patch)
treee9e4e7917523b632ed676b411c41a27546c3875b /gcc
parent6778b96ce1fa7ca57bb6d95fb40e769abd02734b (diff)
downloadgcc-9cf5a7e38d9098ce4961b091f70c40e8eb287e65.tar.gz
tree-ssa-alias.c (new_type_alias): New procedure to create a type memory tag for a pointer with a may-alias set...
2005-05-29 Keith Besaw <kbesaw@us.ibm.com> * tree-ssa-alias.c (new_type_alias): New procedure to create a type memory tag for a pointer with a may-alias set determined from a variable declaration. * tree-flow.h: export declaration of new_type_alias * tree-optimize.c (init_tree_optimization_passes): document that pass_may_alias cannot be called after pass_vectorize. * tree-vect-transform (vect_create_data_ref_ptr): Call new_type_alias when an type memory tag isn't available for a reference. (vectorizable_store): Use copy_virtual_operands to update virtual defs in place (so that loop_version can be called). Call mark_for_renaming for the virtual defs in case peeling is done and virtual uses outside the loop need to be updated. From-SVN: r100322
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog16
-rw-r--r--gcc/tree-flow.h1
-rw-r--r--gcc/tree-optimize.c3
-rw-r--r--gcc/tree-ssa-alias.c33
-rw-r--r--gcc/tree-vect-transform.c39
5 files changed, 74 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5c9b9fddb0f..b0a3949f6fb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,19 @@
+2005-05-29 Keith Besaw <kbesaw@us.ibm.com>
+
+ * tree-ssa-alias.c (new_type_alias): New procedure to
+ create a type memory tag for a pointer with a may-alias
+ set determined from a variable declaration.
+ * tree-flow.h: export declaration of new_type_alias
+ * tree-optimize.c (init_tree_optimization_passes): document
+ that pass_may_alias cannot be called after pass_vectorize.
+ * tree-vect-transform (vect_create_data_ref_ptr): Call
+ new_type_alias when an type memory tag isn't available
+ for a reference.
+ (vectorizable_store): Use copy_virtual_operands to update
+ virtual defs in place (so that loop_version can be called).
+ Call mark_for_renaming for the virtual defs in case peeling
+ is done and virtual uses outside the loop need to be updated.
+
2005-05-29 Dorit Naishlos <dorit@il.ibm.com>
PR tree-optimization/21639
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h
index 0bbfb778a77..fda3e576892 100644
--- a/gcc/tree-flow.h
+++ b/gcc/tree-flow.h
@@ -570,6 +570,7 @@ extern void debug_points_to_info_for (tree);
extern bool may_be_aliased (tree);
extern struct ptr_info_def *get_ptr_info (tree);
extern void add_type_alias (tree, tree);
+extern void new_type_alias (tree, tree);
extern void count_uses_and_derefs (tree, tree, unsigned *, unsigned *, bool *);
static inline subvar_t get_subvars_for_var (tree);
static inline bool ref_contains_array_ref (tree);
diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c
index 825c2b194fc..4d02e5572cc 100644
--- a/gcc/tree-optimize.c
+++ b/gcc/tree-optimize.c
@@ -478,6 +478,9 @@ init_tree_optimization_passes (void)
NEXT_PASS (pass_iv_canon);
NEXT_PASS (pass_if_conversion);
NEXT_PASS (pass_vectorize);
+ /* NEXT_PASS (pass_may_alias) cannot be done again because the
+ vectorizer creates alias relations that are not supported by
+ pass_may_alias. */
NEXT_PASS (pass_lower_vector_ssa);
NEXT_PASS (pass_complete_unroll);
NEXT_PASS (pass_iv_optimize);
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 2ed712bea70..f8b992accd6 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -2776,6 +2776,39 @@ found_tag:
}
+/* Create a type tag for PTR. Construct the may-alias list of this type tag
+ so that it has the aliasing of VAR. */
+
+void
+new_type_alias (tree ptr, tree var)
+{
+ var_ann_t p_ann = var_ann (ptr);
+ tree tag_type = TREE_TYPE (TREE_TYPE (ptr));
+ var_ann_t v_ann = var_ann (var);
+ tree tag;
+ subvar_t svars;
+
+ gcc_assert (p_ann->type_mem_tag == NULL_TREE);
+ gcc_assert (v_ann->mem_tag_kind == NOT_A_TAG);
+ tag = create_memory_tag (tag_type, true);
+ p_ann->type_mem_tag = tag;
+
+ /* Add VAR to the may-alias set of PTR's new type tag. If VAR has
+ subvars, add the subvars to the tag instead of the actual var. */
+ if (var_can_have_subvars (var)
+ && (svars = get_subvars_for_var (var)))
+ {
+ subvar_t sv;
+ for (sv = svars; sv; sv = sv->next)
+ add_may_alias (tag, sv->var);
+ }
+ else
+ add_may_alias (tag, var);
+
+ /* Note, TAG and its set of aliases are not marked for renaming. */
+}
+
+
/* This structure is simply used during pushing fields onto the fieldstack
to track the offset of the field, since bitpos_of_field gives it relative
to its immediate containing type, and we want it relative to the ultimate
diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c
index 0079fc887af..9be19dc2eb4 100644
--- a/gcc/tree-vect-transform.c
+++ b/gcc/tree-vect-transform.c
@@ -350,16 +350,13 @@ vect_create_data_ref_ptr (tree stmt, block_stmt_iterator *bsi, tree offset,
tag = STMT_VINFO_MEMTAG (stmt_info);
gcc_assert (tag);
- /* If the memory tag of the original reference was not a type tag or
- if the pointed-to type of VECT_PTR has an alias set number
- different than TAG's, then we need to create a new type tag for
- VECT_PTR and add TAG to its alias set. */
- if (var_ann (tag)->mem_tag_kind == NOT_A_TAG
- || get_alias_set (tag) != get_alias_set (TREE_TYPE (vect_ptr_type)))
- add_type_alias (vect_ptr, tag);
+ /* If tag is a variable (and NOT_A_TAG) than a new type alias
+ tag must be created with tag added to its may alias list. */
+ if (var_ann (tag)->mem_tag_kind == NOT_A_TAG)
+ new_type_alias (vect_ptr, tag);
else
var_ann (vect_ptr)->type_mem_tag = tag;
-
+
var_ann (vect_ptr)->subvars = STMT_VINFO_SUBVARS (stmt_info);
/** (3) Calculate the initial address the vector-pointer, and set
@@ -896,8 +893,8 @@ vectorizable_store (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
enum machine_mode vec_mode;
tree dummy;
enum dr_alignment_support alignment_support_cheme;
- ssa_op_iter iter;
tree def;
+ ssa_op_iter iter;
/* Is vectorizable store? */
@@ -955,16 +952,22 @@ vectorizable_store (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt)
*vec_stmt = build2 (MODIFY_EXPR, vectype, data_ref, vec_oprnd1);
vect_finish_stmt_generation (stmt, *vec_stmt, bsi);
- /* Mark all non-SSA variables in the statement for rewriting. */
- mark_new_vars_to_rename (*vec_stmt);
-
- /* The new vectorized statement will have better aliasing
- information, so some of the virtual definitions of the old
- statement will likely disappear from the IL. Mark them to have
- their SSA form updated. */
+ /* Copy the V_MAY_DEFS representing the aliasing of the original array
+ element's definition to the vector's definition then update the
+ defining statement. The original is being deleted so the same
+ SSA_NAMEs can be used. */
+ copy_virtual_operands (*vec_stmt, stmt);
+
FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_VMAYDEF)
- mark_sym_for_renaming (SSA_NAME_VAR (def));
-
+ {
+ SSA_NAME_DEF_STMT (def) = *vec_stmt;
+
+ /* If this virtual def has a use outside the loop and a loop peel is performed
+ then the def may be renamed by the peel. Mark it for renaming so the
+ later use will also be renamed. */
+ mark_sym_for_renaming (SSA_NAME_VAR (def));
+ }
+
return true;
}