Commit e03a46f5 by Diego Novillo Committed by Diego Novillo

re PR tree-optimization/19121 (ICE: in merge_alias_info, at tree-ssa-copy.c:236)


	PR tree-optimization/19121
	* tree-ssa-alias.c (compute_flow_sensitive_aliasing): When
	adding aliases to a name tag, also add them to the pointer's
	type tag.
	* tree-ssa-copy.c (merge_alias_info): Do not merge flow
	sensitive alias info at all.  Only check that the two pointers
	have compatible pointed-to sets.
	* tree-ssa.c (verify_name_tags): Verify that the alias set of
	a pointer's type tag is a superset of the alias set of the
	pointer's name tag.

testsuite/ChangeLog:

	PR tree-optimization/19121
	* gcc.c-torture/compile/pr19121.c: New test.

From-SVN: r93810
parent 696a2ca1
2005-01-17 Diego Novillo <dnovillo@redhat.com>
PR tree-optimization/19121
* tree-ssa-alias.c (compute_flow_sensitive_aliasing): When
adding aliases to a name tag, also add them to the pointer's
type tag.
* tree-ssa-copy.c (merge_alias_info): Do not merge flow
sensitive alias info at all. Only check that the two pointers
have compatible pointed-to sets.
* tree-ssa.c (verify_name_tags): Verify that the alias set of
a pointer's type tag is a superset of the alias set of the
pointer's name tag.
2005-01-17 James E Wilson <wilson@specifixinc.com> 2005-01-17 James E Wilson <wilson@specifixinc.com>
PR target/19357 PR target/19357
......
2005-01-17 Diego Novillo <dnovillo@redhat.com>
PR tree-optimization/19121
* gcc.c-torture/compile/pr19121.c: New test.
2005-01-17 James E. Wilson <wilson@specifixinc.com> 2005-01-17 James E. Wilson <wilson@specifixinc.com>
PR target/19357 PR target/19357
......
typedef struct interpreter {
char Itokenbuf[256];
} PerlInterpreter;
static inline void S_missingterm(char *s)
{
char tmpbuf[3] = "";
char q;
if (!s)
s = tmpbuf;
q = strchr(s,'"') ? '\'' : '"';
}
void S_scan_heredoc(PerlInterpreter *my_perl, char *s, int i)
{
char term;
term = *my_perl->Itokenbuf;
if (i)
{
*s = term;
S_missingterm(my_perl->Itokenbuf);
}
else
S_missingterm(my_perl->Itokenbuf);
}
...@@ -913,6 +913,7 @@ compute_flow_sensitive_aliasing (struct alias_info *ai) ...@@ -913,6 +913,7 @@ compute_flow_sensitive_aliasing (struct alias_info *ai)
EXECUTE_IF_SET_IN_BITMAP (pi->pt_vars, 0, j, bi) EXECUTE_IF_SET_IN_BITMAP (pi->pt_vars, 0, j, bi)
{ {
add_may_alias (pi->name_mem_tag, referenced_var (j)); add_may_alias (pi->name_mem_tag, referenced_var (j));
add_may_alias (v_ann->type_mem_tag, referenced_var (j));
} }
/* If the name tag is call clobbered, so is the type tag /* If the name tag is call clobbered, so is the type tag
......
...@@ -178,10 +178,10 @@ merge_alias_info (tree orig, tree new) ...@@ -178,10 +178,10 @@ merge_alias_info (tree orig, tree new)
tree orig_sym = SSA_NAME_VAR (orig); tree orig_sym = SSA_NAME_VAR (orig);
var_ann_t new_ann = var_ann (new_sym); var_ann_t new_ann = var_ann (new_sym);
var_ann_t orig_ann = var_ann (orig_sym); var_ann_t orig_ann = var_ann (orig_sym);
struct ptr_info_def *orig_ptr_info;
gcc_assert (POINTER_TYPE_P (TREE_TYPE (orig))); gcc_assert (POINTER_TYPE_P (TREE_TYPE (orig)));
gcc_assert (POINTER_TYPE_P (TREE_TYPE (new))); gcc_assert (POINTER_TYPE_P (TREE_TYPE (new)));
#if defined ENABLE_CHECKING #if defined ENABLE_CHECKING
gcc_assert (lang_hooks.types_compatible_p (TREE_TYPE (orig), gcc_assert (lang_hooks.types_compatible_p (TREE_TYPE (orig),
TREE_TYPE (new))); TREE_TYPE (new)));
...@@ -202,41 +202,30 @@ merge_alias_info (tree orig, tree new) ...@@ -202,41 +202,30 @@ merge_alias_info (tree orig, tree new)
else else
gcc_assert (new_ann->type_mem_tag == orig_ann->type_mem_tag); gcc_assert (new_ann->type_mem_tag == orig_ann->type_mem_tag);
orig_ptr_info = SSA_NAME_PTR_INFO (orig); #if defined ENABLE_CHECKING
if (orig_ptr_info && orig_ptr_info->name_mem_tag)
{ {
struct ptr_info_def *new_ptr_info = get_ptr_info (new); struct ptr_info_def *orig_ptr_info = SSA_NAME_PTR_INFO (orig);
struct ptr_info_def *new_ptr_info = SSA_NAME_PTR_INFO (new);
if (new_ptr_info->name_mem_tag == NULL_TREE)
if (orig_ptr_info
&& new_ptr_info
&& orig_ptr_info->name_mem_tag
&& new_ptr_info->name_mem_tag
&& orig_ptr_info->pt_vars
&& new_ptr_info->pt_vars)
{ {
/* If ORIG had a name tag, it means that was dereferenced in /* Note that pointer NEW may actually have a different set of
the code, and since pointer NEW will now replace every pointed-to variables. However, since NEW is being
occurrence of ORIG, we have to make sure that NEW has an copy-propagated into ORIG, it must always be true that the
appropriate tag. If, NEW did not have a name tag, get it pointed-to set for pointer NEW is the same, or a subset, of
from ORIG. */ the pointed-to set for pointer ORIG. If this isn't the case,
memcpy (new_ptr_info, orig_ptr_info, sizeof (*new_ptr_info)); we shouldn't have been able to do the propagation of NEW into
new_ptr_info->pt_vars = BITMAP_GGC_ALLOC (); ORIG. */
bitmap_copy (new_ptr_info->pt_vars, orig_ptr_info->pt_vars);
new_ptr_info->name_mem_tag = orig_ptr_info->name_mem_tag;
}
else
{
/* If NEW already had a name tag, nothing needs to be done.
Note that pointer NEW may actually have a different set of
pointed-to variables.
However, since NEW is being copy-propagated into ORIG, it must
always be true that the pointed-to set for pointer NEW is the
same, or a subset, of the pointed-to set for pointer ORIG. If
this isn't the case, we shouldn't have been able to do the
propagation of NEW into ORIG. */
#if defined ENABLE_CHECKING
if (orig_ptr_info->pt_vars && new_ptr_info->pt_vars)
gcc_assert (bitmap_intersect_p (new_ptr_info->pt_vars, gcc_assert (bitmap_intersect_p (new_ptr_info->pt_vars,
orig_ptr_info->pt_vars)); orig_ptr_info->pt_vars));
#endif
} }
} }
#endif
} }
......
...@@ -469,7 +469,11 @@ DEF_VEC_MALLOC_P (bitmap); ...@@ -469,7 +469,11 @@ DEF_VEC_MALLOC_P (bitmap);
same name tag must have the same points-to set. same name tag must have the same points-to set.
So we check a single variable for each name tag, and verify that its So we check a single variable for each name tag, and verify that its
points-to set is different from every other points-to set for other name points-to set is different from every other points-to set for other name
tags. */ tags.
Additionally, given a pointer P_i with name tag NMT and type tag
TMT, this function verified the alias set of TMT is a superset of
the alias set of NMT. */
static void static void
verify_name_tags (void) verify_name_tags (void)
...@@ -479,25 +483,62 @@ verify_name_tags (void) ...@@ -479,25 +483,62 @@ verify_name_tags (void)
bitmap first, second; bitmap first, second;
VEC (tree) *name_tag_reps = NULL; VEC (tree) *name_tag_reps = NULL;
VEC (bitmap) *pt_vars_for_reps = NULL; VEC (bitmap) *pt_vars_for_reps = NULL;
bitmap type_aliases = BITMAP_XMALLOC ();
/* First we compute the name tag representatives and their points-to sets. */ /* First we compute the name tag representatives and their points-to sets. */
for (i = 0; i < num_ssa_names; i++) for (i = 0; i < num_ssa_names; i++)
{ {
if (ssa_name (i)) struct ptr_info_def *pi;
{ tree tmt, ptr = ssa_name (i);
tree ptr = ssa_name (i);
struct ptr_info_def *pi = SSA_NAME_PTR_INFO (ptr); if (ptr == NULL_TREE)
continue;
pi = SSA_NAME_PTR_INFO (ptr);
if (!TREE_VISITED (ptr) if (!TREE_VISITED (ptr)
|| !POINTER_TYPE_P (TREE_TYPE (ptr)) || !POINTER_TYPE_P (TREE_TYPE (ptr))
|| !pi || !pi
|| !pi->name_mem_tag || !pi->name_mem_tag
|| TREE_VISITED (pi->name_mem_tag)) || TREE_VISITED (pi->name_mem_tag))
continue; continue;
TREE_VISITED (pi->name_mem_tag) = 1; TREE_VISITED (pi->name_mem_tag) = 1;
if (pi->pt_vars != NULL)
{ if (pi->pt_vars == NULL)
continue;
VEC_safe_push (tree, name_tag_reps, ptr); VEC_safe_push (tree, name_tag_reps, ptr);
VEC_safe_push (bitmap, pt_vars_for_reps, pi->pt_vars); VEC_safe_push (bitmap, pt_vars_for_reps, pi->pt_vars);
/* Verify that alias set of PTR's type tag is a superset of the
alias set of PTR's name tag. */
tmt = var_ann (SSA_NAME_VAR (ptr))->type_mem_tag;
if (tmt)
{
size_t i;
varray_type aliases = var_ann (tmt)->may_aliases;
bitmap_clear (type_aliases);
for (i = 0; aliases && i < VARRAY_ACTIVE_SIZE (aliases); i++)
{
tree alias = VARRAY_TREE (aliases, i);
bitmap_set_bit (type_aliases, var_ann (alias)->uid);
}
/* When grouping, we may have added PTR's type tag into the
alias set of PTR's name tag. To prevent a false
positive, pretend that TMT is in its own alias set. */
bitmap_set_bit (type_aliases, var_ann (tmt)->uid);
if (bitmap_equal_p (type_aliases, pi->pt_vars))
continue;
if (!bitmap_intersect_compl_p (type_aliases, pi->pt_vars))
{
error ("Alias set of a pointer's type tag should be a superset of the corresponding name tag");
debug_variable (tmt);
debug_variable (pi->name_mem_tag);
goto err;
} }
} }
} }
...@@ -532,13 +573,17 @@ verify_name_tags (void) ...@@ -532,13 +573,17 @@ verify_name_tags (void)
TREE_VISITED (pi->name_mem_tag) = 0; TREE_VISITED (pi->name_mem_tag) = 0;
} }
} }
VEC_free (bitmap, pt_vars_for_reps); VEC_free (bitmap, pt_vars_for_reps);
BITMAP_FREE (type_aliases);
return; return;
err: err:
debug_variable (VEC_index (tree, name_tag_reps, i)); debug_variable (VEC_index (tree, name_tag_reps, i));
internal_error ("verify_name_tags failed"); internal_error ("verify_name_tags failed");
} }
/* Verify the consistency of aliasing information. */ /* Verify the consistency of aliasing information. */
static void static void
......
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