Commit 59e6913a by Richard Guenther Committed by Richard Biener

tree-ssa-alias.c (finalize_ref_all_pointers): Remove.

2008-04-29  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-alias.c (finalize_ref_all_pointers): Remove.
	(compute_may_aliases): Do not call finalize_ref_all_pointers.
	(compute_flow_insensitive_aliasing): Do not treat
	PTR_IS_REF_ALL pointers special.
	(get_smt_for): Likewise.
	(may_alias_p): Re-structure.
	(is_escape_site): A ref-all pointer conversion is not an escape site.
	* tree-ssa-structalias.c (find_what_p_points_to): Do not treat
	PTR_IS_REF_ALL pointers special.
	* tree-ssa-structalias.h (struct alias_info): Remove
	ref_all_symbol_mem_tag field.
	(PTR_IS_REF_ALL): Remove.

From-SVN: r134797
parent c4e82de9
2008-04-29 Richard Guenther <rguenther@suse.de> 2008-04-29 Richard Guenther <rguenther@suse.de>
* tree-ssa-alias.c (finalize_ref_all_pointers): Remove.
(compute_may_aliases): Do not call finalize_ref_all_pointers.
(compute_flow_insensitive_aliasing): Do not treat
PTR_IS_REF_ALL pointers special.
(get_smt_for): Likewise.
(may_alias_p): Re-structure.
(is_escape_site): A ref-all pointer conversion is not an escape site.
* tree-ssa-structalias.c (find_what_p_points_to): Do not treat
PTR_IS_REF_ALL pointers special.
* tree-ssa-structalias.h (struct alias_info): Remove
ref_all_symbol_mem_tag field.
(PTR_IS_REF_ALL): Remove.
2008-04-29 Richard Guenther <rguenther@suse.de>
PR middle-end/36077 PR middle-end/36077
* fold-const.c (extract_muldiv_1): In combining division constants * fold-const.c (extract_muldiv_1): In combining division constants
make sure to never overflow. make sure to never overflow.
......
...@@ -196,7 +196,6 @@ static bitmap_obstack alias_bitmap_obstack; ...@@ -196,7 +196,6 @@ static bitmap_obstack alias_bitmap_obstack;
/* Local functions. */ /* Local functions. */
static void compute_flow_insensitive_aliasing (struct alias_info *); static void compute_flow_insensitive_aliasing (struct alias_info *);
static void finalize_ref_all_pointers (struct alias_info *);
static void dump_alias_stats (FILE *); static void dump_alias_stats (FILE *);
static bool may_alias_p (tree, alias_set_type, tree, alias_set_type, bool); static bool may_alias_p (tree, alias_set_type, tree, alias_set_type, bool);
static tree create_memory_tag (tree type, bool is_type_tag); static tree create_memory_tag (tree type, bool is_type_tag);
...@@ -1800,12 +1799,6 @@ compute_may_aliases (void) ...@@ -1800,12 +1799,6 @@ compute_may_aliases (void)
avoid invalid transformations on them. */ avoid invalid transformations on them. */
maybe_create_global_var (); maybe_create_global_var ();
/* If the program contains ref-all pointers, finalize may-alias information
for them. This pass needs to be run after call-clobbering information
has been computed. */
if (ai->ref_all_symbol_mem_tag)
finalize_ref_all_pointers (ai);
/* Compute memory partitions for every memory variable. */ /* Compute memory partitions for every memory variable. */
compute_memory_partitions (); compute_memory_partitions ();
...@@ -2408,10 +2401,6 @@ compute_flow_insensitive_aliasing (struct alias_info *ai) ...@@ -2408,10 +2401,6 @@ compute_flow_insensitive_aliasing (struct alias_info *ai)
tree tag = symbol_mem_tag (p_map->var); tree tag = symbol_mem_tag (p_map->var);
tree var; tree var;
/* Call-clobbering information is not finalized yet at this point. */
if (PTR_IS_REF_ALL (p_map->var))
continue;
for (j = 0; j < ai->num_addressable_vars; j++) for (j = 0; j < ai->num_addressable_vars; j++)
{ {
struct alias_map_d *v_map; struct alias_map_d *v_map;
...@@ -2473,9 +2462,6 @@ compute_flow_insensitive_aliasing (struct alias_info *ai) ...@@ -2473,9 +2462,6 @@ compute_flow_insensitive_aliasing (struct alias_info *ai)
tree tag1 = symbol_mem_tag (p_map1->var); tree tag1 = symbol_mem_tag (p_map1->var);
bitmap may_aliases1 = MTAG_ALIASES (tag1); bitmap may_aliases1 = MTAG_ALIASES (tag1);
if (PTR_IS_REF_ALL (p_map1->var))
continue;
for (j = 0; j < ai->num_pointers; j++) for (j = 0; j < ai->num_pointers; j++)
{ {
struct alias_map_d *p_map2 = ai->pointers[j]; struct alias_map_d *p_map2 = ai->pointers[j];
...@@ -2486,9 +2472,6 @@ compute_flow_insensitive_aliasing (struct alias_info *ai) ...@@ -2486,9 +2472,6 @@ compute_flow_insensitive_aliasing (struct alias_info *ai)
if (tag1 == tag2) if (tag1 == tag2)
continue; continue;
if (PTR_IS_REF_ALL (p_map2->var))
continue;
/* If the pointers may not point to each other, do nothing. */ /* If the pointers may not point to each other, do nothing. */
if (!may_alias_p (p_map1->var, p_map1->set, tag2, p_map2->set, true)) if (!may_alias_p (p_map1->var, p_map1->set, tag2, p_map2->set, true))
continue; continue;
...@@ -2505,49 +2488,6 @@ compute_flow_insensitive_aliasing (struct alias_info *ai) ...@@ -2505,49 +2488,6 @@ compute_flow_insensitive_aliasing (struct alias_info *ai)
} }
/* Finalize may-alias information for ref-all pointers. Traverse all
the addressable variables found in setup_pointers_and_addressables.
If flow-sensitive alias analysis has attached a name memory tag to
a ref-all pointer, we will use it for the dereferences because that
will have more precise aliasing information. But if there is no
name tag, we will use a special symbol tag that aliases all the
call-clobbered addressable variables. */
static void
finalize_ref_all_pointers (struct alias_info *ai)
{
size_t i;
/* First add the real call-clobbered variables. */
for (i = 0; i < ai->num_addressable_vars; i++)
{
tree var = ai->addressable_vars[i]->var;
if (is_call_clobbered (var))
add_may_alias (ai->ref_all_symbol_mem_tag, var);
}
/* Then add the call-clobbered pointer memory tags. See
compute_flow_insensitive_aliasing for the rationale. */
for (i = 0; i < ai->num_pointers; i++)
{
tree ptr = ai->pointers[i]->var, tag;
/* Avoid adding to self and clean up. */
if (PTR_IS_REF_ALL (ptr))
{
struct ptr_info_def *pi = get_ptr_info (ptr);
if (pi->is_dereferenced)
pi->pt_anything = 0;
continue;
}
tag = symbol_mem_tag (ptr);
if (is_call_clobbered (tag))
add_may_alias (ai->ref_all_symbol_mem_tag, tag);
}
}
/* Create a new alias set entry for VAR in AI->ADDRESSABLE_VARS. */ /* Create a new alias set entry for VAR in AI->ADDRESSABLE_VARS. */
static void static void
...@@ -2842,22 +2782,23 @@ may_alias_p (tree ptr, alias_set_type mem_alias_set, ...@@ -2842,22 +2782,23 @@ may_alias_p (tree ptr, alias_set_type mem_alias_set,
return false; return false;
} }
gcc_assert (TREE_CODE (mem) == SYMBOL_MEMORY_TAG); /* If the pointed to memory has alias set zero, or the pointer
is ref-all, or the pointer decl is marked that no TBAA is to
if (!DECL_NO_TBAA_P (ptr)) be applied, the MEM can alias VAR. */
{
alias_stats.tbaa_queries++;
/* If the pointed to memory has alias set zero or the pointer
is ref-all, the MEM can alias VAR. */
if (mem_alias_set == 0 if (mem_alias_set == 0
|| PTR_IS_REF_ALL (ptr)) || DECL_POINTER_ALIAS_SET (ptr) == 0
|| TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (ptr))
|| DECL_NO_TBAA_P (ptr))
{ {
alias_stats.alias_mayalias++; alias_stats.alias_mayalias++;
alias_stats.tbaa_resolved++; alias_stats.simple_resolved++;
return true; return true;
} }
gcc_assert (TREE_CODE (mem) == SYMBOL_MEMORY_TAG);
alias_stats.tbaa_queries++;
/* If the alias sets don't conflict then MEM cannot alias VAR. */ /* If the alias sets don't conflict then MEM cannot alias VAR. */
if (mem_alias_set != var_alias_set if (mem_alias_set != var_alias_set
&& !alias_set_subset_of (mem_alias_set, var_alias_set)) && !alias_set_subset_of (mem_alias_set, var_alias_set))
...@@ -2881,8 +2822,8 @@ may_alias_p (tree ptr, alias_set_type mem_alias_set, ...@@ -2881,8 +2822,8 @@ may_alias_p (tree ptr, alias_set_type mem_alias_set,
/* The star count is -1 if the type at the end of the /* The star count is -1 if the type at the end of the
pointer_to chain is not a record or union type. */ pointer_to chain is not a record or union type. */
if ((!alias_set_only) && if (!alias_set_only
ipa_type_escape_star_count_of_interesting_type (var_type) >= 0) && ipa_type_escape_star_count_of_interesting_type (var_type) >= 0)
{ {
int ptr_star_count = 0; int ptr_star_count = 0;
...@@ -2922,7 +2863,6 @@ may_alias_p (tree ptr, alias_set_type mem_alias_set, ...@@ -2922,7 +2863,6 @@ may_alias_p (tree ptr, alias_set_type mem_alias_set,
} }
} }
} }
}
alias_stats.alias_mayalias++; alias_stats.alias_mayalias++;
return true; return true;
...@@ -3026,12 +2966,6 @@ is_escape_site (tree stmt) ...@@ -3026,12 +2966,6 @@ is_escape_site (tree stmt)
pointer escapes since we can't track the integer. */ pointer escapes since we can't track the integer. */
if (POINTER_TYPE_P (from) && !POINTER_TYPE_P (to)) if (POINTER_TYPE_P (from) && !POINTER_TYPE_P (to))
return ESCAPE_BAD_CAST; return ESCAPE_BAD_CAST;
/* Same if the RHS is a conversion between a regular pointer and a
ref-all pointer since we can't track the SMT of the former. */
if (POINTER_TYPE_P (from) && !TYPE_REF_CAN_ALIAS_ALL (from)
&& POINTER_TYPE_P (to) && TYPE_REF_CAN_ALIAS_ALL (to))
return ESCAPE_BAD_CAST;
} }
/* If the LHS is an SSA name, it can't possibly represent a non-local /* If the LHS is an SSA name, it can't possibly represent a non-local
...@@ -3137,14 +3071,6 @@ get_smt_for (tree ptr, struct alias_info *ai) ...@@ -3137,14 +3071,6 @@ get_smt_for (tree ptr, struct alias_info *ai)
tree tag_type = TREE_TYPE (TREE_TYPE (ptr)); tree tag_type = TREE_TYPE (TREE_TYPE (ptr));
alias_set_type tag_set = get_alias_set (tag_type); alias_set_type tag_set = get_alias_set (tag_type);
/* We use a unique memory tag for all the ref-all pointers. */
if (PTR_IS_REF_ALL (ptr))
{
if (!ai->ref_all_symbol_mem_tag)
ai->ref_all_symbol_mem_tag = create_memory_tag (void_type_node, true);
return ai->ref_all_symbol_mem_tag;
}
/* To avoid creating unnecessary memory tags, only create one memory tag /* To avoid creating unnecessary memory tags, only create one memory tag
per alias set class. Note that it may be tempting to group per alias set class. Note that it may be tempting to group
memory tags based on conflicting alias sets instead of memory tags based on conflicting alias sets instead of
......
...@@ -4969,17 +4969,9 @@ find_what_p_points_to (tree p) ...@@ -4969,17 +4969,9 @@ find_what_p_points_to (tree p)
/* Instead of using pt_anything, we merge in the SMT aliases /* Instead of using pt_anything, we merge in the SMT aliases
for the underlying SMT. In addition, if they could have for the underlying SMT. In addition, if they could have
pointed to anything, they could point to global memory. pointed to anything, they could point to global memory. */
But we cannot do that for ref-all pointers because these
aliases have not been computed yet. */
if (was_pt_anything) if (was_pt_anything)
{ {
if (PTR_IS_REF_ALL (p))
{
pi->pt_anything = 1;
return false;
}
merge_smts_into (p, finished_solution); merge_smts_into (p, finished_solution);
pi->pt_global_mem = 1; pi->pt_global_mem = 1;
} }
......
...@@ -21,9 +21,6 @@ ...@@ -21,9 +21,6 @@
#ifndef TREE_SSA_STRUCTALIAS_H #ifndef TREE_SSA_STRUCTALIAS_H
#define TREE_SSA_STRUCTALIAS_H #define TREE_SSA_STRUCTALIAS_H
/* True if the data pointed to by PTR can alias anything. */
#define PTR_IS_REF_ALL(PTR) TYPE_REF_CAN_ALIAS_ALL (TREE_TYPE (PTR))
struct constraint; struct constraint;
typedef struct constraint *constraint_t; typedef struct constraint *constraint_t;
...@@ -57,9 +54,6 @@ struct alias_info ...@@ -57,9 +54,6 @@ struct alias_info
/* Pointers that have been used in an indirect load operation. */ /* Pointers that have been used in an indirect load operation. */
struct pointer_set_t *dereferenced_ptrs_load; struct pointer_set_t *dereferenced_ptrs_load;
/* Memory tag for all the PTR_IS_REF_ALL pointers. */
tree ref_all_symbol_mem_tag;
}; };
/* In tree-ssa-alias.c. */ /* In tree-ssa-alias.c. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment