+2007-02-08 Diego Novillo <dnovillo@redhat.com>
+
+ PR 30562
+ * tree-flow.h (struct var_ann_d): Remove field 'is_used'.
+ Update all users.
+ * tree-ssa-alias.c (compute_is_aliased): Remove. Update all
+ users.
+ (init_alias_info):
+ * tree-ssa-live.c (remove_unused_locals): Do not remove
+ TREE_ADDRESSABLE variables.
+ * tree-ssa-structalias.c (compute_points_to_sets): Tidy.
+ * tree-ssa-operands.c (add_virtual_operand): Remove argument
+ FOR_CLOBBER. Update all users.
+ If VAR has an associated alias set, add a virtual operand for
+ it if no alias is found to conflict with the memory reference.
+
2007-02-07 Jan Hubicka <jh@suse.cz>
Robert Kidd <rkidd@crhc.uiuc.edu>
print_generic_expr (file, ann->symbol_mem_tag, dump_flags);
}
- if (ann && ann->is_aliased)
- fprintf (file, ", is aliased");
-
if (TREE_ADDRESSABLE (var))
fprintf (file, ", is addressable");
/* Used when building base variable structures in a var_map. */
unsigned base_var_processed : 1;
- /* Nonzero if this variable is in the alias set of another variable. */
- unsigned is_aliased : 1;
-
/* Nonzero if this variable was used after SSA optimizations were
applied. We set this when translating out of SSA form. */
unsigned used : 1;
timevar_pop (TV_MEMORY_PARTITIONING);
}
-/* This function computes the value of the is_aliased bit for
- variables. is_aliased is true for any variable that is in an
- alias bitmap. */
-
-static void
-compute_is_aliased (void)
-{
- referenced_var_iterator rvi;
- tree tag;
- bitmap aliased_vars = BITMAP_ALLOC (NULL);
- bitmap_iterator bi;
- unsigned int i;
-
- /* Add is_aliased for all vars pointed to by the symbol tags. */
- FOR_EACH_REFERENCED_VAR (tag, rvi)
- {
- bitmap aliases;
- if (TREE_CODE (tag) != SYMBOL_MEMORY_TAG
- && TREE_CODE (tag) != NAME_MEMORY_TAG)
- continue;
- aliases = MTAG_ALIASES (tag);
- if (!aliases)
- continue;
-
- bitmap_ior_into (aliased_vars, aliases);
- }
-
- EXECUTE_IF_SET_IN_BITMAP (aliased_vars, 0, i, bi)
- {
- tree var = referenced_var (i);
-
- var_ann (var)->is_aliased = true;
- }
-
- BITMAP_FREE (aliased_vars);
-}
-
/* Compute may-alias information for every variable referenced in function
FNDECL.
dump_points_to_info (dump_file);
dump_alias_info (dump_file);
}
-
- /* Set up is_aliased flags. */
- compute_is_aliased ();
/* Deallocate memory used by aliasing data structures. */
delete_alias_info (ai);
/* Clear flow-insensitive alias information from each symbol. */
FOR_EACH_REFERENCED_VAR (var, rvi)
{
- var_ann_t ann = var_ann (var);
-
- ann->is_aliased = 0;
-
if (MTAG_P (var))
MTAG_ALIASES (var) = NULL;
cell = &TREE_CHAIN (*cell);
}
- /* Remove unused variables from REFERENCED_VARs. As an special exception
- keep the variables that are believed to be aliased. Those can't be
- easily removed from the alias sets and and operand caches.
- They will be removed shortly after next may_alias pass is performed. */
+ /* Remove unused variables from REFERENCED_VARs. As a special
+ exception keep the variables that are believed to be aliased.
+ Those can't be easily removed from the alias sets and operand
+ caches. They will be removed shortly after the next may_alias
+ pass is performed. */
FOR_EACH_REFERENCED_VAR (t, rvi)
if (!is_global_var (t)
&& !MTAG_P (t)
&& TREE_CODE (t) != PARM_DECL
&& TREE_CODE (t) != RESULT_DECL
&& !(ann = var_ann (t))->used
- && !ann->is_aliased && !is_call_clobbered (t) && !ann->symbol_mem_tag)
- remove_referenced_var (t);
+ && !ann->symbol_mem_tag
+ && !TREE_ADDRESSABLE (t))
+ remove_referenced_var (t);
}
get_expr_operands. FULL_REF is a tree that contains the entire
pointer dereference expression, if available, or NULL otherwise.
OFFSET and SIZE come from the memory access expression that
- generated this virtual operand. FOR_CLOBBER is true is this is
- adding a virtual operand for a call clobber. */
+ generated this virtual operand. */
static void
add_virtual_operand (tree var, stmt_ann_t s_ann, int flags,
tree full_ref, HOST_WIDE_INT offset,
- HOST_WIDE_INT size, bool for_clobber)
+ HOST_WIDE_INT size)
{
bitmap aliases = NULL;
tree sym;
append_vdef (al);
}
- /* If the variable is also an alias tag, add a virtual
- operand for it, otherwise we will miss representing
- references to the members of the variable's alias set.
- This fixes the bug in gcc.c-torture/execute/20020503-1.c.
-
- It is also necessary to add bare defs on clobbers for
- SMT's, so that bare SMT uses caused by pruning all the
- aliases will link up properly with calls. In order to
- keep the number of these bare defs we add down to the
- minimum necessary, we keep track of which SMT's were used
- alone in statement vdefs or VUSEs. */
- if (v_ann->is_aliased
- || none_added
- || (TREE_CODE (var) == SYMBOL_MEMORY_TAG
- && for_clobber))
- {
- append_vdef (var);
- }
+ /* Even if no aliases have been added, we still need to
+ establish def-use and use-def chains, lest
+ transformations think that this is not a memory
+ reference. For an example of this scenario, see
+ testsuite/g++.dg/opt/cleanup1.C. */
+ if (none_added)
+ append_vdef (var);
}
else
{
append_vuse (al);
}
- /* Similarly, append a virtual uses for VAR itself, when
- it is an alias tag. */
- if (v_ann->is_aliased || none_added)
+ /* Even if no aliases have been added, we still need to
+ establish def-use and use-def chains, lest
+ transformations think that this is not a memory
+ reference. For an example of this scenario, see
+ testsuite/g++.dg/opt/cleanup1.C. */
+ if (none_added)
append_vuse (var);
}
}
append_use (var_p);
}
else
- add_virtual_operand (var, s_ann, flags, NULL_TREE, 0, -1, false);
+ add_virtual_operand (var, s_ann, flags, NULL_TREE, 0, -1);
}
{
/* PTR has its own memory tag. Use it. */
add_virtual_operand (pi->name_mem_tag, s_ann, flags,
- full_ref, offset, size, false);
+ full_ref, offset, size);
}
else
{
if (v_ann->symbol_mem_tag)
add_virtual_operand (v_ann->symbol_mem_tag, s_ann, flags,
- full_ref, offset, size, false);
+ full_ref, offset, size);
/* Aliasing information is missing; mark statement as volatile so we
won't optimize it out too actively. */
else if (s_ann && !gimple_aliases_computed_p (cfun)
clobber_stats.static_read_clobbers_avoided++;
}
else
- add_virtual_operand (var, s_ann, opf_def, NULL, 0, -1, true);
+ add_virtual_operand (var, s_ann, opf_def, NULL, 0, -1);
}
}
if (is_gimple_reg (PHI_RESULT (phi)))
{
find_func_aliases (phi);
+
/* Update various related attributes like escaped
addresses, pointer dereferences for loads and stores.
This is used when creating name tags and alias
verify_flow_insensitive_alias_info (void)
{
tree var;
- bitmap visited = BITMAP_ALLOC (NULL);
referenced_var_iterator rvi;
FOR_EACH_REFERENCED_VAR (var, rvi)
EXECUTE_IF_SET_IN_BITMAP (aliases, 0, j, bi)
{
alias = referenced_var (j);
- bitmap_set_bit (visited, j);
if (TREE_CODE (alias) != MEMORY_PARTITION_TAG
&& !may_be_aliased (alias))
}
}
- FOR_EACH_REFERENCED_VAR (var, rvi)
- {
- var_ann_t ann;
- ann = var_ann (var);
-
- if (!MTAG_P (var)
- && ann->is_aliased
- && memory_partition (var) == NULL_TREE
- && !bitmap_bit_p (visited, DECL_UID (var)))
- {
- error ("addressable variable that is aliased but is not in any "
- "alias set");
- goto err;
- }
- }
-
- BITMAP_FREE (visited);
return;
err: