re PR tree-optimization/46467 (gcc.dg/torture/pta-structcopy-1.c FAILs with -fipa-pta without inlining)

2010-11-15  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/46467
	* tree-ssa-structalias.c (do_structure_copy): Properly treat
	variables without subvars.

	* gcc.dg/ipa/ipa-pta-16.c: New testcase.

From-SVN: r166755
This commit is contained in:
Richard Guenther 2010-11-15 14:15:33 +00:00 committed by Richard Biener
parent d0a4fd975a
commit c636a4fbf6
4 changed files with 52 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2010-11-15 Richard Guenther <rguenther@suse.de>
PR tree-optimization/46467
* tree-ssa-structalias.c (do_structure_copy): Properly treat
variables without subvars.
2010-11-15 Hariharan Sandanagobalane <hariharan@picochip.com> 2010-11-15 Hariharan Sandanagobalane <hariharan@picochip.com>
* config/picochip/picochip.c (file header): Picochip name change. * config/picochip/picochip.c (file header): Picochip name change.

View File

@ -1,3 +1,8 @@
2010-11-15 Richard Guenther <rguenther@suse.de>
PR tree-optimization/46467
* gcc.dg/ipa/ipa-pta-16.c: New testcase.
2010-11-15 Richard Guenther <rguenther@suse.de> 2010-11-15 Richard Guenther <rguenther@suse.de>
PR testsuite/46423 PR testsuite/46423

View File

@ -0,0 +1,33 @@
/* { dg-do run } */
/* { dg-options "-O2 -fno-tree-sra -fipa-pta -fdump-ipa-pta" } */
struct X
{
long l1;
struct Y
{
long l2;
int *p;
} y;
};
int i;
static int __attribute__((noinline))
foo (struct X *x)
{
struct Y y = x->y;
*y.p = 0;
i = 1;
return *y.p;
}
extern void abort (void);
int main()
{
struct X x;
x.y.p = &i;
if (foo(&x) != 1)
abort ();
return 0;
}
/* { dg-final { scan-ipa-dump "y.\[0-9\]*\\\+\[0-9\]* = { i }" "pta" } } */
/* { dg-final { cleanup-ipa-dump "pta" } } */

View File

@ -3541,11 +3541,15 @@ do_structure_copy (tree lhsop, tree rhsop)
lhsv = get_varinfo (lhsp->var); lhsv = get_varinfo (lhsp->var);
rhsv = get_varinfo (rhsp->var); rhsv = get_varinfo (rhsp->var);
if (lhsv->may_have_pointers if (lhsv->may_have_pointers
&& ranges_overlap_p (lhsv->offset + rhsoffset, lhsv->size, && (lhsv->is_full_var
rhsv->offset + lhsoffset, rhsv->size)) || rhsv->is_full_var
|| ranges_overlap_p (lhsv->offset + rhsoffset, lhsv->size,
rhsv->offset + lhsoffset, rhsv->size)))
process_constraint (new_constraint (*lhsp, *rhsp)); process_constraint (new_constraint (*lhsp, *rhsp));
if (lhsv->offset + rhsoffset + lhsv->size if (!rhsv->is_full_var
> rhsv->offset + lhsoffset + rhsv->size) && (lhsv->is_full_var
|| (lhsv->offset + rhsoffset + lhsv->size
> rhsv->offset + lhsoffset + rhsv->size)))
{ {
++k; ++k;
if (k >= VEC_length (ce_s, rhsc)) if (k >= VEC_length (ce_s, rhsc))