Commit ae536040 by Zdenek Dvorak Committed by Zdenek Dvorak

re PR tree-optimization/14784 ([Tree-ssa] alias analysis deficiency)

	PR tree-optimization/14784
	* tree-flow.h (struct var_ann_d): Add is_heapvar bit.
	* tree-ssa-structalias.c (get_constraint_for,
	intra_create_variable_infos): Set is_heapvar.
	* tree-ssa-operands.c (access_can_touch_variable): Do not handle
	non-heapvar pointer variables specially.

	* gcc.dg/alias-10.c: New test.

From-SVN: r117986
parent 4d5fc916
2006-10-23 Zdenek Dvorak <dvorakz@suse.cz>
PR tree-optimization/14784
* tree-flow.h (struct var_ann_d): Add is_heapvar bit.
* tree-ssa-structalias.c (get_constraint_for,
intra_create_variable_infos): Set is_heapvar.
* tree-ssa-operands.c (access_can_touch_variable): Do not handle
non-heapvar pointer variables specially.
2006-10-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2006-10-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
PR middle-end/29335 PR middle-end/29335
......
2006-10-23 Zdenek Dvorak <dvorakz@suse.cz>
PR tree-optimization/14784
* gcc.dg/alias-10.c: New test.
2006-10-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2006-10-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* gcc.dg/torture/builtin-sin-mpfr-1.c: New test. * gcc.dg/torture/builtin-sin-mpfr-1.c: New test.
/* For PR tree-optimization/14784 */
/* { dg-do compile } */
/* { dg-options "-O2 -funswitch-loops -fdump-tree-unswitch-details" } */
typedef struct bitmap_element_def
{
unsigned int indx;
} bitmap_element;
typedef struct bitmap_head_def {
bitmap_element *first;
int using_obstack;
} bitmap_head;
typedef struct bitmap_head_def *bitmap;
bitmap_element *bitmap_free;
void foo (bitmap head, bitmap_element *elt)
{
while (1)
{
/* Alias analysis problems used to prevent us from recognizing
that this condition is invariant. */
if (head->using_obstack)
bitmap_free = elt;
}
}
/* { dg-final { scan-tree-dump-times "Unswitching" 1 "unswitch"} } */
/* { dg-final { cleanup-tree-dump "unswitch" } } */
...@@ -184,6 +184,9 @@ struct var_ann_d GTY(()) ...@@ -184,6 +184,9 @@ struct var_ann_d GTY(())
in the v_may_def list. */ in the v_may_def list. */
unsigned in_v_may_def_list : 1; unsigned in_v_may_def_list : 1;
/* True for HEAP and PARM_NOALIAS artificial variables. */
unsigned is_heapvar : 1;
/* An artificial variable representing the memory location pointed-to by /* An artificial variable representing the memory location pointed-to by
all the pointer symbols that flow-insensitive alias analysis all the pointer symbols that flow-insensitive alias analysis
(mostly type-based) considers to be aliased. If the variable is (mostly type-based) considers to be aliased. If the variable is
......
...@@ -1151,11 +1151,11 @@ access_can_touch_variable (tree ref, tree alias, HOST_WIDE_INT offset, ...@@ -1151,11 +1151,11 @@ access_can_touch_variable (tree ref, tree alias, HOST_WIDE_INT offset,
&& flag_strict_aliasing && flag_strict_aliasing
&& TREE_CODE (ref) != INDIRECT_REF && TREE_CODE (ref) != INDIRECT_REF
&& !MTAG_P (alias) && !MTAG_P (alias)
&& !var_ann (alias)->is_heapvar
&& (TREE_CODE (base) != INDIRECT_REF && (TREE_CODE (base) != INDIRECT_REF
|| TREE_CODE (TREE_TYPE (base)) != UNION_TYPE) || TREE_CODE (TREE_TYPE (base)) != UNION_TYPE)
&& !AGGREGATE_TYPE_P (TREE_TYPE (alias)) && !AGGREGATE_TYPE_P (TREE_TYPE (alias))
&& TREE_CODE (TREE_TYPE (alias)) != COMPLEX_TYPE && TREE_CODE (TREE_TYPE (alias)) != COMPLEX_TYPE
&& !POINTER_TYPE_P (TREE_TYPE (alias))
/* When the struct has may_alias attached to it, we need not to /* When the struct has may_alias attached to it, we need not to
return true. */ return true. */
&& get_alias_set (base)) && get_alias_set (base))
......
...@@ -2640,6 +2640,7 @@ get_constraint_for (tree t, VEC (ce_s, heap) **results) ...@@ -2640,6 +2640,7 @@ get_constraint_for (tree t, VEC (ce_s, heap) **results)
{ {
heapvar = create_tmp_var_raw (ptr_type_node, "HEAP"); heapvar = create_tmp_var_raw (ptr_type_node, "HEAP");
DECL_EXTERNAL (heapvar) = 1; DECL_EXTERNAL (heapvar) = 1;
get_var_ann (heapvar)->is_heapvar = 1;
if (referenced_vars) if (referenced_vars)
add_referenced_var (heapvar); add_referenced_var (heapvar);
heapvar_insert (t, heapvar); heapvar_insert (t, heapvar);
...@@ -4281,6 +4282,7 @@ intra_create_variable_infos (void) ...@@ -4281,6 +4282,7 @@ intra_create_variable_infos (void)
{ {
heapvar = create_tmp_var_raw (TREE_TYPE (TREE_TYPE (t)), heapvar = create_tmp_var_raw (TREE_TYPE (TREE_TYPE (t)),
"PARM_NOALIAS"); "PARM_NOALIAS");
get_var_ann (heapvar)->is_heapvar = 1;
DECL_EXTERNAL (heapvar) = 1; DECL_EXTERNAL (heapvar) = 1;
if (referenced_vars) if (referenced_vars)
add_referenced_var (heapvar); add_referenced_var (heapvar);
......
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