Commit e5bae89b by Richard Guenther Committed by Richard Biener

tree-ssa-structalias.c (struct variable_info): Add is_full_var flag.

2008-07-07  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-structalias.c (struct variable_info): Add is_full_var flag.
	(new_var_info): Set it to false.
	(solution_set_add): Correctly handle pointers outside a var and
	inside a field.
	(type_safe): Treat variables with is_full_var properly.
	(do_sd_constraint): Likewise.
	(do_ds_constraint): Likewise.
	(process_constraint): Remove zeroing offset for !use_field_sensitive.
	(get_constraint_for_ptr_offset): New function.
	(get_constraint_for_component_ref): For addresses at least include
	the last field of the variable.  Handle is_full_vars properly.
	(get_constraint_for_1): Factor common code, handle POINTER_PLUS_EXPR.
	(handle_ptr_arith): Remove.
	(find_func_aliases): Simplify assignment handling.
	(create_function_info_for): For parameter and result varinfos set
	is_full_var flag.
	(create_variable_info_for): Set is_full_var flag whenever we
	just created a single varinfo for a decl.
	(init_alias_vars): Initialize use_field_sensitive from
	max-fields-for-field-sensitive parameter.

	* gcc.dg/torture/pta-ptrarith-1.c: New testcase.
	* gcc.dg/torture/pta-ptrarith-2.c: Likewise.
	* gcc.dg/torture/ipa-pta-1.c: Likewise.

From-SVN: r137573
parent 77092cda
2008-07-07 Richard Guenther <rguenther@suse.de> 2008-07-07 Richard Guenther <rguenther@suse.de>
* tree-ssa-structalias.c (struct variable_info): Add is_full_var flag.
(new_var_info): Set it to false.
(solution_set_add): Correctly handle pointers outside a var and
inside a field.
(type_safe): Treat variables with is_full_var properly.
(do_sd_constraint): Likewise.
(do_ds_constraint): Likewise.
(process_constraint): Remove zeroing offset for !use_field_sensitive.
(get_constraint_for_ptr_offset): New function.
(get_constraint_for_component_ref): For addresses at least include
the last field of the variable. Handle is_full_vars properly.
(get_constraint_for_1): Factor common code, handle POINTER_PLUS_EXPR.
(handle_ptr_arith): Remove.
(find_func_aliases): Simplify assignment handling.
(create_function_info_for): For parameter and result varinfos set
is_full_var flag.
(create_variable_info_for): Set is_full_var flag whenever we
just created a single varinfo for a decl.
(init_alias_vars): Initialize use_field_sensitive from
max-fields-for-field-sensitive parameter.
2008-07-07 Richard Guenther <rguenther@suse.de>
PR tree-optimization/36713 PR tree-optimization/36713
* tree-flow-inline.h (is_call_used): New function. * tree-flow-inline.h (is_call_used): New function.
* tree-nrv.c (dest_safe_for_nrv_p): Use it. * tree-nrv.c (dest_safe_for_nrv_p): Use it.
......
2008-07-07 Richard Guenther <rguenther@suse.de>
* gcc.dg/torture/pta-ptrarith-1.c: New testcase.
* gcc.dg/torture/pta-ptrarith-2.c: Likewise.
* gcc.dg/torture/ipa-pta-1.c: Likewise.
2008-07-07 Jakub Jelinek <jakub@redhat.com> 2008-07-07 Jakub Jelinek <jakub@redhat.com>
PR middle-end/36726 PR middle-end/36726
......
/* { dg-do compile } */
/* { dg-options "-fipa-pta -fdump-ipa-pta" } */
/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
struct X { char x; char y; };
void bar (char *p);
void test1 (char a, char b, char c, char d, char e, char f, char g, char h)
{
char *p = &a;
p++;
bar (p);
}
void test2 (struct X a, char b, char c, char d, char e, char f, char g, char h)
{
char *p = &a.x;
p++;
bar (p);
}
void test3 (struct X a, char b, char c, char d, char e, char f, char g, char h)
{
char *p = &a.y;
bar (p);
}
void test4 (int a, char b, char c, char d, char e, char f, char g, char h)
{
char *p = (char *)&a;
p++;
p++;
p++;
p++;
bar (p);
}
/* { dg-final { scan-ipa-dump "bar.arg0 = { test4.arg0 test3.arg0 test2.arg0 test1.arg0 }" "pta" } } */
/* { dg-final { cleanup-ipa-dump "pta" } } */
/* { dg-do run } */
/* { dg-options "-fdump-tree-alias" } */
/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
struct Foo {
int *p;
};
void __attribute__((noinline))
foo (void *p)
{
struct Foo *f = (struct Foo *)p - 1;
*f->p = 0;
}
int bar (void)
{
struct Foo f;
int i = 1;
f.p = &i;
foo (&f + 1);
return i;
}
extern void abort (void);
int main()
{
if (bar () != 0)
abort ();
return 0;
}
/* { dg-final { scan-tree-dump "ESCAPED = { ESCAPED NONLOCAL f .* i }" "alias" } } */
/* { dg-final { cleanup-tree-dump "alias" } } */
/* { dg-do run } */
/* { dg-options "-fdump-tree-alias" } */
/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
struct Foo {
int **p;
int **q;
};
int __attribute__((noinline))
bar (void)
{
struct Foo f;
int j, i = 1;
char *p;
int *x = &i;
int *y = &j;
f.p = &y;
f.q = &x;
p = (char *)&f;
for (j = 0; j < sizeof (int *); ++j)
p++;
return ***(int ***)p;
}
extern void abort (void);
int main()
{
if (bar () != 1)
abort ();
return 0;
}
/* In theory = { i } is the correct solution. But it's not easy to scan
for that reliably, so just use what we create now. */
/* { dg-final { scan-tree-dump "= { i j }" "alias" } } */
/* { dg-final { cleanup-tree-dump "alias" } } */
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