aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@redhat.com>2004-03-12 04:19:06 +0000
committerDiego Novillo <dnovillo@redhat.com>2004-03-12 04:19:06 +0000
commit862368535f1945bdfce591843c723c5711290b8e (patch)
tree744544fe574dd311220e366a1d2fa253e650d2c4
parent8214857e08919532c9691acd8d4345c5fa366fde (diff)
2004-03-11 Diego Novillo <dnovillo@redhat.com>
* tree-dfa.c (struct walk_state): Remove fields 'is_store' and 'is_indirect_ref'. Update all users. * tree-flow.h (struct var_ann_d): Remove fields 'is_stored', 'is_dereferenced_store' and 'is_dereferenced_load'. Update all users. * tree-simple.c (get_base_address): Handle BIT_FIELD_REF. * tree-ssa-alias.c (struct alias_info): Add fields 'written_vars', 'dereferenced_ptrs_store' and 'dereferenced_ptrs_load'. (init_alias_info): Initialize them. (delete_alias_info): Free them. (find_ptr_dereference): New. (ptr_is_dereferenced_by): Call it. Add new argument 'is_store'. Set to true if the expression is an indirect store operation. (compute_points_to_and_addr_escape): If the statement makes a store, load or write operation, update the corresponding bitmap. (compute_flow_insensitive_aliasing): Test the 'written_vars' bitmap to determine if alias sets should be computed. (setup_pointers_and_addressables): Always assume that volatile pointers and hidden pointers have been used in a memory store operation. * tree-ssa-operands.c (add_stmt_operand): Do add an operand for may-aliased variables before computing aliases. 2004-03-11 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> * tree-optimize.c (init_tree_optimization_passes): Move pass_tail_recursion and pass_ch after pass_may_alias. * tree-ssa-loop.c (mark_defs_for_rewrite): Mark type tags for rewriting. * tree-ssa.c (mark_def_sites): Process the operand of a VDEF before the result. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/tree-ssa-20020619-branch@79367 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog.tree-ssa39
-rw-r--r--gcc/tree-dfa.c97
-rw-r--r--gcc/tree-flow.h9
-rw-r--r--gcc/tree-optimize.c4
-rw-r--r--gcc/tree-simple.c1
-rw-r--r--gcc/tree-ssa-alias.c143
-rw-r--r--gcc/tree-ssa-copy.c7
-rw-r--r--gcc/tree-ssa-copyrename.c5
-rw-r--r--gcc/tree-ssa-loop.c14
-rw-r--r--gcc/tree-ssa-operands.c13
-rw-r--r--gcc/tree-ssa.c5
11 files changed, 186 insertions, 151 deletions
diff --git a/gcc/ChangeLog.tree-ssa b/gcc/ChangeLog.tree-ssa
index b25553af1f3..3fb25c62919 100644
--- a/gcc/ChangeLog.tree-ssa
+++ b/gcc/ChangeLog.tree-ssa
@@ -1,3 +1,42 @@
+2004-03-11 Diego Novillo <dnovillo@redhat.com>
+
+ * tree-dfa.c (struct walk_state): Remove fields 'is_store' and
+ 'is_indirect_ref'. Update all users.
+ * tree-flow.h (struct var_ann_d): Remove fields 'is_stored',
+ 'is_dereferenced_store' and 'is_dereferenced_load'. Update
+ all users.
+ * tree-simple.c (get_base_address): Handle BIT_FIELD_REF.
+ * tree-ssa-alias.c (struct alias_info): Add fields
+ 'written_vars', 'dereferenced_ptrs_store' and
+ 'dereferenced_ptrs_load'.
+ (init_alias_info): Initialize them.
+ (delete_alias_info): Free them.
+ (find_ptr_dereference): New.
+ (ptr_is_dereferenced_by): Call it.
+ Add new argument 'is_store'. Set to true if the
+ expression is an indirect store operation.
+ (compute_points_to_and_addr_escape): If the statement
+ makes a store, load or write operation, update the
+ corresponding bitmap.
+ (compute_flow_insensitive_aliasing): Test the
+ 'written_vars' bitmap to determine if alias sets should
+ be computed.
+ (setup_pointers_and_addressables): Always assume that
+ volatile pointers and hidden pointers have been used in a
+ memory store operation.
+ * tree-ssa-operands.c (add_stmt_operand): Do add an
+ operand for may-aliased variables before computing
+ aliases.
+
+2004-03-11 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
+
+ * tree-optimize.c (init_tree_optimization_passes): Move
+ pass_tail_recursion and pass_ch after pass_may_alias.
+ * tree-ssa-loop.c (mark_defs_for_rewrite): Mark type tags
+ for rewriting.
+ * tree-ssa.c (mark_def_sites): Process the operand of a
+ VDEF before the result.
+
2004-03-11 Richard Henderson <rth@redhat.com>
PR 14204
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 787a30c0268..bdb89dd1eef 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -67,12 +67,6 @@ struct dfa_stats_d
/* State information for find_vars_r. */
struct walk_state
{
- /* Nonzero if the variables found under the current tree are written to. */
- int is_store : 1;
-
- /* Nonzero if the walker is inside an INDIRECT_REF node. */
- int is_indirect_ref : 1;
-
/* Hash table used to avoid adding the same variable more than once. */
htab_t vars_found;
};
@@ -112,7 +106,7 @@ varray_type referenced_vars;
static void
find_referenced_vars (void)
{
- static htab_t vars_found;
+ htab_t vars_found;
basic_block bb;
block_stmt_iterator si;
struct walk_state walk_state;
@@ -562,15 +556,6 @@ dump_variable (FILE *file, tree var)
if (is_call_clobbered (var))
fprintf (file, ", call clobbered");
- if (ann->is_stored)
- fprintf (file, ", is written to");
-
- if (ann->is_dereferenced_store)
- fprintf (file, ", is dereferenced to store");
-
- if (ann->is_dereferenced_load)
- fprintf (file, ", is dereferenced to load");
-
if (ann->default_def)
{
fprintf (file, ", default def: ");
@@ -916,9 +901,7 @@ find_vars_r (tree *tp, int *walk_subtrees, void *data)
tree *lhs_p = &TREE_OPERAND (t, 0);
tree *rhs_p = &TREE_OPERAND (t, 1);
- walk_state->is_store = 1;
walk_tree (lhs_p, find_vars_r, walk_state, NULL);
- walk_state->is_store = 0;
walk_tree (rhs_p, find_vars_r, walk_state, NULL);
/* If either side makes volatile references, mark the statement. */
@@ -928,28 +911,6 @@ find_vars_r (tree *tp, int *walk_subtrees, void *data)
return t;
}
- else if (TREE_CODE (t) == ASM_EXPR)
- {
- walk_state->is_store = 1;
- walk_tree (&ASM_OUTPUTS (t), find_vars_r, walk_state, NULL);
- walk_tree (&ASM_CLOBBERS (t), find_vars_r, walk_state, NULL);
- walk_state->is_store = 0;
- walk_tree (&ASM_INPUTS (t), find_vars_r, walk_state, NULL);
- return t;
- }
- else if (TREE_CODE (t) == INDIRECT_REF)
- {
- walk_state->is_indirect_ref = 1;
- walk_tree (&TREE_OPERAND (t, 0), find_vars_r, walk_state, NULL);
-
- /* INDIRECT_REF nodes cannot be nested in GIMPLE, so there is no need
- of saving/restoring the state. */
- walk_state->is_indirect_ref = 0;
-
- /* Keep iterating, because an INDIRECT_REF node may have more
- references inside (structures and arrays). */
- return NULL_TREE;
- }
if (SSA_VAR_P (t))
{
@@ -957,27 +918,6 @@ find_vars_r (tree *tp, int *walk_subtrees, void *data)
return NULL_TREE;
}
- /* A function call that receives pointer arguments may dereference them.
- For every pointer 'p' in the argument to the function call, add a
- reference to '*p'. */
- if (TREE_CODE (t) == CALL_EXPR)
- {
- tree op;
-
- for (op = TREE_OPERAND (t, 1); op; op = TREE_CHAIN (op))
- {
- tree arg = TREE_VALUE (op);
- if (SSA_VAR_P (arg)
- && POINTER_TYPE_P (TREE_TYPE (arg))
- && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (arg))))
- {
- walk_state->is_indirect_ref = 1;
- add_referenced_var (arg, walk_state);
- walk_state->is_indirect_ref = 0;
- }
- }
- }
-
return NULL_TREE;
}
@@ -987,10 +927,10 @@ find_vars_r (tree *tp, int *walk_subtrees, void *data)
tag, add it to the POINTERS array. These two arrays are used for
alias analysis (See compute_alias_sets).
- WALK_STATE is an array with a hash table used to avoid adding the
- same variable more than once to its corresponding set as well as flags
- indicating if we're processing a load or store. Note that this function
- assumes that VAR is a valid SSA variable. */
+ WALK_STATE contains a hash table used to avoid adding the same
+ variable more than once to its corresponding set as well as flags
+ indicating if we're processing a load or store. Note that this
+ function assumes that VAR is a valid SSA variable. */
static void
add_referenced_var (tree var, struct walk_state *walk_state)
@@ -1024,28 +964,6 @@ add_referenced_var (tree var, struct walk_state *walk_state)
if (DECL_NONLOCAL (var))
v_ann->used = 1;
}
-
- /* Now, set attributes that depend on WALK_STATE. */
- if (walk_state == NULL)
- return;
-
- /* Remember if the variable has been written to. This is important for
- alias analysis. If a variable and its aliases are never modified, it
- is not interesting for the optimizers because there are no aliased
- stores to keep track of. */
- if (walk_state->is_store)
- v_ann->is_stored = 1;
-
- /* If VAR is a pointer referenced in an INDIRECT_REF node, mark it so
- that alias analysis creates a memory tag representing the location
- pointed-to by pointer VAR. */
- if (walk_state->is_indirect_ref)
- {
- if (walk_state->is_store)
- v_ann->is_dereferenced_store = 1;
- else
- v_ann->is_dereferenced_load = 1;
- }
}
@@ -1139,9 +1057,8 @@ find_hidden_use_vars_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
/* Add a temporary variable to REFERENCED_VARS. This is similar to
add_referenced_var, but is used by passes that need to add new temps to
the REFERENCED_VARS array after the program has been scanned for
- variables. In particular, none of the annotations that depend on struct
- walk_state will be set. The variable will just receive a new UID and be
- added to the REFERENCED_VARS array without checking for duplicates. */
+ variables. The variable will just receive a new UID and be added
+ to the REFERENCED_VARS array without checking for duplicates. */
void
add_referenced_tmp_var (tree var)
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h
index f78743cdac9..95eb1f5417f 100644
--- a/gcc/tree-flow.h
+++ b/gcc/tree-flow.h
@@ -106,9 +106,6 @@ struct var_ann_d GTY(())
has been performed. */
unsigned has_hidden_use : 1;
- /* Nonzero if this variable was stored/written in the function. */
- unsigned is_stored : 1;
-
/* Used by the out of SSA pass to determine whether this variable has
been seen yet or not. */
unsigned out_of_ssa_tag : 1;
@@ -128,12 +125,6 @@ struct var_ann_d GTY(())
applied. We set this when translating out of SSA form. */
unsigned used : 1;
- /* Nonzero if this variable is a pointer that has been dereferenced in a
- store or a load operation. Pointers that have been dereferenced are
- the only ones that need to have memory tags associated to them. */
- unsigned is_dereferenced_store : 1;
- unsigned is_dereferenced_load : 1;
-
/* This field indicates whether or not the variable may need PHI nodes.
See the enum's definition for more detailed information about the
states. */
diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c
index e5b55f66d2b..e7778cff9f1 100644
--- a/gcc/tree-optimize.c
+++ b/gcc/tree-optimize.c
@@ -287,8 +287,9 @@ init_tree_optimization_passes (void)
NEXT_PASS (DUP_PASS (pass_dce));
NEXT_PASS (pass_forwprop);
NEXT_PASS (pass_phiopt);
- NEXT_PASS (pass_ch);
NEXT_PASS (pass_may_alias);
+ NEXT_PASS (pass_tail_recursion);
+ NEXT_PASS (pass_ch);
NEXT_PASS (pass_del_pta);
NEXT_PASS (pass_profile);
NEXT_PASS (pass_lower_complex);
@@ -300,7 +301,6 @@ init_tree_optimization_passes (void)
NEXT_PASS (pass_dse);
NEXT_PASS (DUP_PASS (pass_forwprop));
NEXT_PASS (DUP_PASS (pass_phiopt));
- NEXT_PASS (pass_tail_recursion);
NEXT_PASS (pass_loop);
NEXT_PASS (pass_ccp);
NEXT_PASS (DUP_PASS (pass_redundant_phi));
diff --git a/gcc/tree-simple.c b/gcc/tree-simple.c
index e2d313a1b05..61e8998ff00 100644
--- a/gcc/tree-simple.c
+++ b/gcc/tree-simple.c
@@ -607,6 +607,7 @@ get_base_address (tree t)
case COMPONENT_REF:
case REALPART_EXPR:
case IMAGPART_EXPR:
+ case BIT_FIELD_REF:
t = TREE_OPERAND (t, 0);
break;
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 4f1f4377b31..5fee057c437 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -103,6 +103,15 @@ struct alias_info
/* Total number of virtual operands that will be needed to represent
all the aliases of all the pointers found in the program. */
long total_alias_vops;
+
+ /* Variables that have been written to. */
+ bitmap written_vars;
+
+ /* Pointers that have been used in an indirect store operation. */
+ bitmap dereferenced_ptrs_store;
+
+ /* Pointers that have been used in an indirect load operation. */
+ bitmap dereferenced_ptrs_load;
};
@@ -143,7 +152,7 @@ static void add_pointed_to_var (struct alias_info *, tree, tree);
static void add_pointed_to_expr (tree, tree);
static void create_global_var (void);
static void collect_points_to_info_for (struct alias_info *, tree);
-static bool ptr_is_dereferenced_by (tree, tree);
+static bool ptr_is_dereferenced_by (tree, tree, bool *);
static void maybe_create_global_var (struct alias_info *ai);
static void group_aliases (struct alias_info *);
@@ -367,6 +376,9 @@ init_alias_info (void)
created during alias analysis. Since we can't create more than 2 tags
per pointer, 3 times the number of referenced vars is enough. */
ai->num_references = xcalloc (3 * num_referenced_vars, sizeof (size_t));
+ ai->written_vars = BITMAP_XMALLOC ();
+ ai->dereferenced_ptrs_store = BITMAP_XMALLOC ();
+ ai->dereferenced_ptrs_load = BITMAP_XMALLOC ();
return ai;
}
@@ -398,6 +410,10 @@ delete_alias_info (struct alias_info *ai)
free (ai->pointers);
free (ai->num_references);
+ BITMAP_FREE (ai->written_vars);
+ BITMAP_FREE (ai->dereferenced_ptrs_store);
+ BITMAP_FREE (ai->dereferenced_ptrs_load);
+
free (ai);
}
@@ -434,14 +450,33 @@ collect_points_to_info_for (struct alias_info *ai, tree ptr)
}
-/* Return true if STMT contains INDIRECT_REF <PTR>. */
+/* Helper for ptr_is_dereferenced_by. Called by walk_tree to look for
+ INDIRECT_REF nodes for the pointer passed in DATA. */
+
+static tree
+find_ptr_dereference (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, void *data)
+{
+ tree ptr = (tree) data;
+
+ if (TREE_CODE (*tp) == INDIRECT_REF
+ && TREE_OPERAND (*tp, 0) == ptr)
+ return *tp;
+
+ return NULL_TREE;
+}
+
+
+/* Return true if STMT contains INDIRECT_REF <PTR>. *IS_STORE is set
+ to 'true' if the dereference is on the LHS of an assignment. */
static bool
-ptr_is_dereferenced_by (tree ptr, tree stmt)
+ptr_is_dereferenced_by (tree ptr, tree stmt, bool *is_store)
{
+ *is_store = false;
+
if (TREE_CODE (stmt) == MODIFY_EXPR
|| (TREE_CODE (stmt) == RETURN_EXPR
- && TREE_CODE (TREE_OPERAND (stmt, 0)) == MODIFY_EXPR))
+ && TREE_CODE (TREE_OPERAND (stmt, 0)) == MODIFY_EXPR))
{
tree e, lhs, rhs;
@@ -449,19 +484,29 @@ ptr_is_dereferenced_by (tree ptr, tree stmt)
lhs = TREE_OPERAND (e, 0);
rhs = TREE_OPERAND (e, 1);
- if (TREE_CODE_CLASS (TREE_CODE (lhs)) == 'r')
+ if (EXPR_P (lhs)
+ && walk_tree (&lhs, find_ptr_dereference, ptr, NULL))
+ {
+ *is_store = true;
+ return true;
+ }
+ else if (EXPR_P (rhs)
+ && walk_tree (&rhs, find_ptr_dereference, ptr, NULL))
{
- lhs = get_base_address (lhs);
- if (lhs && TREE_CODE (lhs) == INDIRECT_REF
- && TREE_OPERAND (lhs, 0) == ptr)
- return true;
+ return true;
}
- if (TREE_CODE_CLASS (TREE_CODE (rhs)) == 'r')
+ }
+ else if (TREE_CODE (stmt) == ASM_EXPR)
+ {
+ if (walk_tree (&ASM_OUTPUTS (stmt), find_ptr_dereference, ptr, NULL)
+ || walk_tree (&ASM_CLOBBERS (stmt), find_ptr_dereference, ptr, NULL))
+ {
+ *is_store = true;
+ return true;
+ }
+ else if (walk_tree (&ASM_INPUTS (stmt), find_ptr_dereference, ptr, NULL))
{
- rhs = get_base_address (rhs);
- if (rhs && TREE_CODE (rhs) == INDIRECT_REF
- && TREE_OPERAND (rhs, 0) == ptr)
- return true;
+ return true;
}
}
@@ -489,6 +534,7 @@ compute_points_to_and_addr_escape (struct alias_info *ai)
{
use_optype uses;
def_optype defs;
+ vdef_optype vdefs;
stmt_ann_t ann;
bitmap addr_taken;
tree stmt = bsi_stmt (si);
@@ -534,6 +580,7 @@ compute_points_to_and_addr_escape (struct alias_info *ai)
tree op = USE_OP (uses, i);
var_ann_t v_ann = var_ann (SSA_NAME_VAR (op));
ssa_name_ann_t ptr_ann;
+ bool is_store;
if (may_be_aliased (SSA_NAME_VAR (op)))
ai->num_references[v_ann->uid]++;
@@ -544,7 +591,7 @@ compute_points_to_and_addr_escape (struct alias_info *ai)
collect_points_to_info_for (ai, op);
ptr_ann = ssa_name_ann (op);
- if (ptr_is_dereferenced_by (op, stmt))
+ if (ptr_is_dereferenced_by (op, stmt, &is_store))
{
/* If we found OP to point to a set of variables or
malloc, then create a name memory tag for it. This
@@ -560,6 +607,14 @@ compute_points_to_and_addr_escape (struct alias_info *ai)
/* Keep track of how many time we've dereferenced each
pointer. */
ai->num_references[v_ann->uid]++;
+
+ /* If this is a store operation, mark OP as being
+ dereferenced to store, otherwise mark it as being
+ dereferenced to load. */
+ if (is_store)
+ bitmap_set_bit (ai->dereferenced_ptrs_store, v_ann->uid);
+ else
+ bitmap_set_bit (ai->dereferenced_ptrs_load, v_ann->uid);
}
else if (stmt_escapes_p)
{
@@ -568,6 +623,12 @@ compute_points_to_and_addr_escape (struct alias_info *ai)
why we only check for escape points if OP is not
dereferenced by STMT. */
ptr_ann->value_escapes_p = 1;
+
+ /* If the statement makes a function call, assume
+ that pointer OP will be dereferenced in a store
+ operation inside the called function. */
+ if (get_call_expr_in (stmt))
+ bitmap_set_bit (ai->dereferenced_ptrs_store, v_ann->uid);
}
}
@@ -578,8 +639,21 @@ compute_points_to_and_addr_escape (struct alias_info *ai)
for (i = 0; i < NUM_DEFS (defs); i++)
{
tree op = DEF_OP (defs, i);
- if (may_be_aliased (SSA_NAME_VAR (op)))
- ai->num_references[var_ann (SSA_NAME_VAR (op))->uid]++;
+ tree var = SSA_NAME_VAR (op);
+ var_ann_t ann = var_ann (var);
+ bitmap_set_bit (ai->written_vars, ann->uid);
+ if (may_be_aliased (var))
+ ai->num_references[ann->uid]++;
+ }
+
+ /* Mark variables in VDEF operands as being written to. */
+ vdefs = VDEF_OPS (ann);
+ for (i = 0; i < NUM_VDEFS (vdefs); i++)
+ {
+ tree op = VDEF_OP (vdefs, i);
+ tree var = SSA_NAME_VAR (op);
+ var_ann_t ann = var_ann (var);
+ bitmap_set_bit (ai->written_vars, ann->uid);
}
/* After promoting variables and computing aliasing we will
@@ -706,17 +780,25 @@ compute_flow_insensitive_aliasing (struct alias_info *ai)
struct alias_map_d *v_map;
var_ann_t v_ann;
tree var;
+ bool tag_stored_p, var_stored_p;
v_map = ai->addressable_vars[j];
var = v_map->var;
v_ann = var_ann (var);
- /* Skip memory tags and variables that have never been written to. */
- if (!tag_ann->is_stored && !v_ann->is_stored)
+ /* Skip memory tags and variables that have never been
+ written to. We also need to check if the variables are
+ call-clobbered because they may be overwritten by
+ function calls. */
+ tag_stored_p = bitmap_bit_p (ai->written_vars, tag_ann->uid)
+ || is_call_clobbered (tag);
+ var_stored_p = bitmap_bit_p (ai->written_vars, v_ann->uid)
+ || is_call_clobbered (var);
+ if (!tag_stored_p && !var_stored_p)
continue;
/* Skip memory tags which are written if the variable is readonly. */
- if (tag_ann->is_stored && TREE_READONLY (var))
+ if (tag_stored_p && TREE_READONLY (var))
continue;
if (may_alias_p (p_map->var, p_map->set, var, v_map->set))
@@ -1009,7 +1091,16 @@ setup_pointers_and_addressables (struct alias_info *ai)
num_addressable_vars++;
if (POINTER_TYPE_P (TREE_TYPE (var)))
- num_pointers++;
+ {
+ /* Since we don't keep track of volatile variables nor
+ variables with hidden uses, assume that these pointers
+ are used in indirect store operations. */
+ var_ann_t ann = var_ann (var);
+ if (TREE_THIS_VOLATILE (var) || ann->has_hidden_use)
+ bitmap_set_bit (ai->dereferenced_ptrs_store, ann->uid);
+
+ num_pointers++;
+ }
}
/* Create ADDRESSABLE_VARS and POINTERS. Note that these arrays are
@@ -1081,8 +1172,8 @@ setup_pointers_and_addressables (struct alias_info *ai)
/* Add pointer variables that have been dereferenced to the POINTERS
array and create a type memory tag for them. */
if (POINTER_TYPE_P (TREE_TYPE (var))
- && (v_ann->is_dereferenced_store
- || v_ann->is_dereferenced_load))
+ && (bitmap_bit_p (ai->dereferenced_ptrs_store, v_ann->uid)
+ || bitmap_bit_p (ai->dereferenced_ptrs_load, v_ann->uid)))
{
tree tag = v_ann->type_mem_tag;
var_ann_t t_ann;
@@ -1097,9 +1188,9 @@ setup_pointers_and_addressables (struct alias_info *ai)
v_ann->type_mem_tag = tag;
/* If pointer VAR has been used in a store operation, then its
- memory tag must be marked as stored. */
- if (v_ann->is_dereferenced_store)
- t_ann->is_stored = 1;
+ memory tag must be marked as written-to. */
+ if (bitmap_bit_p (ai->dereferenced_ptrs_store, v_ann->uid))
+ bitmap_set_bit (ai->written_vars, t_ann->uid);
/* If pointer VAR is a global variable or a PARM_DECL, then its
memory tag should be considered a global variable. */
diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
index 59dc991b748..d737c1d89ba 100644
--- a/gcc/tree-ssa-copy.c
+++ b/gcc/tree-ssa-copy.c
@@ -79,13 +79,6 @@ replace_ssa_names (tree *op_p,
var_ann_t new_ann = var_ann (SSA_NAME_VAR (var));
var_ann_t orig_ann = var_ann (SSA_NAME_VAR (*op_p));
- /* Merge the dereferenced attributes for the replacement variable.
- Note that we cannot just copy them. Otherwise, we would mess
- things up if the original variable wasn't dereferenced but the
- replacement was. */
- new_ann->is_dereferenced_store |= orig_ann->is_dereferenced_store;
- new_ann->is_dereferenced_load |= orig_ann->is_dereferenced_load;
-
if (new_ann->type_mem_tag == NULL_TREE)
new_ann->type_mem_tag = orig_ann->type_mem_tag;
else if (orig_ann->type_mem_tag == NULL_TREE)
diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c
index 2bf24988004..8451d0e83a9 100644
--- a/gcc/tree-ssa-copyrename.c
+++ b/gcc/tree-ssa-copyrename.c
@@ -229,11 +229,6 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug)
/* Update the various flag widgitry of the current base representative. */
ann3 = var_ann (SSA_NAME_VAR (partition_to_var (map, p3)));
- ann3->is_stored = ann1->is_stored | ann2->is_stored;
- ann3->is_dereferenced_store
- = (ann1->is_dereferenced_store | ann2->is_dereferenced_store);
- ann3->is_dereferenced_load
- = (ann1->is_dereferenced_load | ann2->is_dereferenced_load);
if (ann1->type_mem_tag)
ann3->type_mem_tag = ann1->type_mem_tag;
else
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
index c308359ba16..7a1a6b8548f 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -152,6 +152,13 @@ mark_defs_for_rewrite (basic_block bb)
{
var = SSA_NAME_VAR (PHI_RESULT (stmt));
bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
+
+ /* If we have a type_mem_tag, add it as well. Due to rewriting the
+ variable out of ssa, we lose its name tag, so we use type_mem_tag
+ instead. */
+ var = var_ann (var)->type_mem_tag;
+ if (var)
+ bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
}
for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
@@ -165,6 +172,13 @@ mark_defs_for_rewrite (basic_block bb)
{
var = SSA_NAME_VAR (DEF_OP (defs, i));
bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
+
+ /* If we have a type_mem_tag, add it as well. Due to rewriting the
+ variable out of ssa, we lose its name tag, so we use type_mem_tag
+ instead. */
+ var = var_ann (var)->type_mem_tag;
+ if (var)
+ bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
}
vdefs = VDEF_OPS (ann);
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index e9a3413c919..5c9fa19d2b9 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -1199,15 +1199,12 @@ add_stmt_operand (tree *var_p, tree stmt, int flags, voperands_t prev_vops)
aliases = v_ann->may_aliases;
- /* If alias information hasn't been computed yet, then addressable
- variables will not be an alias tag nor will they have aliases. In
- this case, simply mark the statement as having volatile operands
- and return. */
+ /* If alias information hasn't been computed yet, then
+ addressable variables will not be an alias tag nor will they
+ have aliases. In this case, mark the statement as having
+ volatile operands. */
if (!aliases_computed_p && may_be_aliased (var))
- {
- s_ann->has_volatile_ops = true;
- return;
- }
+ s_ann->has_volatile_ops = true;
if (aliases == NULL)
{
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index 2497c7838f7..bbe46e3eb12 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -622,9 +622,9 @@ mark_def_sites (struct dom_walk_data *walk_data,
{
VDEF_RESULT (vdefs, i) = VDEF_OP (vdefs, i);
- set_def_block (VDEF_RESULT (vdefs, i), bb);
if (!TEST_BIT (kills, uid))
set_livein_block (VDEF_OP (vdefs, i), bb);
+ set_def_block (VDEF_RESULT (vdefs, i), bb);
}
}
@@ -973,11 +973,8 @@ create_temp (tree t)
of the flags in the annotation. However, some flags we need to
inherit from our original variable. */
var_ann (tmp)->type_mem_tag = var_ann (t)->type_mem_tag;
- var_ann (tmp)->is_dereferenced_load = var_ann (t)->is_dereferenced_load;
- var_ann (tmp)->is_dereferenced_store = var_ann (t)->is_dereferenced_store;
if (is_call_clobbered (t))
mark_call_clobbered (tmp);
- var_ann (tmp)->is_stored = var_ann (t)->is_stored;
return tmp;
}