Commit 0f8d6231 by Richard Guenther Committed by Richard Biener

re PR tree-optimization/45967 (gcc-4.5.x optimizes code with side-effects away)

2010-10-18  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/45967
	* tree-ssa-structalias.c (type_could_have_pointers): Remove.
	(could_have_pointers): Likewise.
	(handle_rhs_call, handle_const_call, handle_pure_call,
	find_func_aliases, intra_create_variable_infos): Remove calls to them.
	(struct fieldoff): Add must_have_pointers field.
	(type_must_have_pointers): New function.
	(field_must_have_pointers): Likewise.
	(push_fields_onto_fieldstack): Remove must_have_pointers_p argument.
	Adjust field merging.
	(create_function_info_for): May-have-pointers of varinfo is
	almost always true.
	(create_variable_info_for_1): Likewise.

	* gcc.dg/torture/pr45967.c: New testcase.
	* gcc.dg/ipa/ipa-pta-10.c: Adjust.
	* gcc.dg/ipa/ipa-pta-13.c: Likewise
	* gcc.dg/torture/pr39074-2.c: Likewise
	* gcc.dg/torture/pta-escape-1.c: Likewise
	* gcc.dg/torture/pta-ptrarith-1.c: Likewise
	* gcc.dg/tree-ssa/pta-callused.c: Likewise
	* gcc.dg/tree-ssa/pta-escape-1.c: Likewise
	* gcc.dg/tree-ssa/pta-escape-2.c: Likewise
	* gcc.dg/tree-ssa/pta-escape-3.c: Likewise
	* gcc.dg/tree-ssa/ssa-pre-21.c: Likewise

From-SVN: r165641
parent 1915c739
2010-10-18 Richard Guenther <rguenther@suse.de>
PR tree-optimization/45967
* tree-ssa-structalias.c (type_could_have_pointers): Remove.
(could_have_pointers): Likewise.
(handle_rhs_call, handle_const_call, handle_pure_call,
find_func_aliases, intra_create_variable_infos): Remove calls to them.
(struct fieldoff): Add must_have_pointers field.
(type_must_have_pointers): New function.
(field_must_have_pointers): Likewise.
(push_fields_onto_fieldstack): Remove must_have_pointers_p argument.
Adjust field merging.
(create_function_info_for): May-have-pointers of varinfo is
almost always true.
(create_variable_info_for_1): Likewise.
2010-10-18 Tejas Belagod <tejas.belagod@arm.com> 2010-10-18 Tejas Belagod <tejas.belagod@arm.com>
* config/arm/neon.md (neon_move_hi_quad_<mode>): Fix the order * config/arm/neon.md (neon_move_hi_quad_<mode>): Fix the order
2010-10-18 Richard Guenther <rguenther@suse.de>
PR tree-optimization/45967
* gcc.dg/torture/pr45967.c: New testcase.
* gcc.dg/ipa/ipa-pta-10.c: Adjust.
* gcc.dg/ipa/ipa-pta-13.c: Likewise
* gcc.dg/torture/pr39074-2.c: Likewise
* gcc.dg/torture/pta-escape-1.c: Likewise
* gcc.dg/torture/pta-ptrarith-1.c: Likewise
* gcc.dg/tree-ssa/pta-callused.c: Likewise
* gcc.dg/tree-ssa/pta-escape-1.c: Likewise
* gcc.dg/tree-ssa/pta-escape-2.c: Likewise
* gcc.dg/tree-ssa/pta-escape-3.c: Likewise
* gcc.dg/tree-ssa/ssa-pre-21.c: Likewise
2010-10-18 Kai Tietz <kai.tietz@onevision.com> 2010-10-18 Kai Tietz <kai.tietz@onevision.com>
* gfortran.dg/bessel_7.f90: Set xfail for mingw targets. * gfortran.dg/bessel_7.f90: Set xfail for mingw targets.
......
...@@ -26,5 +26,5 @@ int main() ...@@ -26,5 +26,5 @@ int main()
/* Verify we properly handle variadic arguments and do not let escape /* Verify we properly handle variadic arguments and do not let escape
stuff through it. */ stuff through it. */
/* { dg-final { scan-ipa-dump "ESCAPED = { }" "pta" } } */ /* { dg-final { scan-ipa-dump "ESCAPED = { ESCAPED NONLOCAL }" "pta" } } */
/* { dg-final { cleanup-ipa-dump "pta" } } */ /* { dg-final { cleanup-ipa-dump "pta" } } */
...@@ -15,6 +15,8 @@ local_address_taken (int *p) ...@@ -15,6 +15,8 @@ local_address_taken (int *p)
*p = 1; *p = 1;
} }
void *anyfn_global;
/* Even though not referenced in this TU we should have added constraints /* Even though not referenced in this TU we should have added constraints
for the initializer. */ for the initializer. */
/* { dg-final { scan-ipa-dump "ex = &local_address_taken" "pta" } } */ /* { dg-final { scan-ipa-dump "ex = &local_address_taken" "pta" } } */
...@@ -24,7 +26,7 @@ extern void link_error (void); ...@@ -24,7 +26,7 @@ extern void link_error (void);
int main() int main()
{ {
void (*anyfn)(int *) = (void (*)(int *))(__SIZE_TYPE__)x; void (*anyfn)(int *) = (void (*)(int *))(__SIZE_TYPE__)anyfn_global;
/* The following should cause local_address_taken to get &x /* The following should cause local_address_taken to get &x
as argument, but not local. We shouldn't get &x added to as argument, but not local. We shouldn't get &x added to
arbitrary special sub-vars of local_address_taken though, arbitrary special sub-vars of local_address_taken though,
...@@ -34,9 +36,13 @@ int main() ...@@ -34,9 +36,13 @@ int main()
We shouldn't get the functions sub-vars in the ESCAPED solution We shouldn't get the functions sub-vars in the ESCAPED solution
though, another missed-optimization. This also causes the functions though, another missed-optimization. This also causes the functions
uses to be messed up even further. */ uses to be messed up even further. */
/* { dg-final { scan-ipa-dump "local_address_taken.arg0 = { ESCAPED NONLOCAL y x }" "pta" } } */ /* ??? As we don't expand the ESCAPED solution we either get x printed here
/* { dg-final { scan-ipa-dump "local_address_taken.clobber = { ESCAPED NONLOCAL y x }" "pta" } } */ or not based on the phase of the moon. */
/* { dg-final { scan-ipa-dump "local_address_taken.arg0 = { ESCAPED NONLOCAL y x }" "pta" { xfail *-*-* } } } */
/* { dg-final { scan-ipa-dump "local_address_taken.clobber = { ESCAPED NONLOCAL y x }" "pta" { xfail *-*-* } } } */
/* { dg-final { scan-ipa-dump "local_address_taken.use = { }" "pta" { xfail *-*-* } } } */ /* { dg-final { scan-ipa-dump "local_address_taken.use = { }" "pta" { xfail *-*-* } } } */
/* ??? But make sure x really escaped. */
/* { dg-final { scan-ipa-dump "ESCAPED = {\[^\n\}\]* x \[^\n\}\]*}" "pta" } } */
(*anyfn) (&x); (*anyfn) (&x);
x = 0; x = 0;
local (&y); local (&y);
......
...@@ -30,5 +30,5 @@ int main() ...@@ -30,5 +30,5 @@ int main()
return 0; return 0;
} }
/* { dg-final { scan-tree-dump "y.._., points-to non-local, points-to escaped, points-to vars: { i }" "alias" } } */ /* { dg-final { scan-tree-dump "y.._., points-to vars: { i }" "alias" } } */
/* { dg-final { cleanup-tree-dump "alias" } } */ /* { dg-final { cleanup-tree-dump "alias" } } */
/* { dg-do run } */
extern void abort (void);
void __attribute__((noinline,noclone))
foo (void *p_)
{
int *p;
int i;
for (i = 0; i < sizeof(int *); ++i)
((char *)&p)[i] = ((char *)p_)[i];
*p = 1;
}
int main()
{
int i = 0;
int *p = &i;
foo (&p);
if (i != 1)
abort ();
return 0;
}
...@@ -30,5 +30,5 @@ main() ...@@ -30,5 +30,5 @@ main()
return 0; return 0;
} }
/* { dg-final { scan-tree-dump "ESCAPED = { ESCAPED NONLOCAL i }" "alias" } } */ /* { dg-final { scan-tree-dump "ESCAPED = {\[^\n\}\]* i \[^\n\}\]*}" "alias" } } */
/* { dg-final { cleanup-tree-dump "alias" } } */ /* { dg-final { cleanup-tree-dump "alias" } } */
...@@ -29,5 +29,5 @@ int main() ...@@ -29,5 +29,5 @@ int main()
return 0; return 0;
} }
/* { dg-final { scan-tree-dump "ESCAPED = { ESCAPED NONLOCAL f .* i }" "alias" } } */ /* { dg-final { scan-tree-dump "ESCAPED = {\[^\n\}\]* i f \[^\n\}\]*}" "alias" } } */
/* { dg-final { cleanup-tree-dump "alias" } } */ /* { dg-final { cleanup-tree-dump "alias" } } */
...@@ -22,6 +22,6 @@ int bar (int b) ...@@ -22,6 +22,6 @@ int bar (int b)
return *foo (&q); return *foo (&q);
} }
/* { dg-final { scan-tree-dump "CALLUSED = { f.* i q }" "alias" } } */ /* { dg-final { scan-tree-dump "CALLUSED = { ESCAPED NONLOCAL f.* i q }" "alias" } } */
/* { dg-final { cleanup-tree-dump "alias" } } */ /* { dg-final { cleanup-tree-dump "alias" } } */
...@@ -33,5 +33,5 @@ int main() ...@@ -33,5 +33,5 @@ int main()
return 0; return 0;
} }
/* { dg-final { scan-tree-dump "ESCAPED, points-to non-local, points-to vars: { x }" "alias" } } */ /* { dg-final { scan-tree-dump "ESCAPED, points-to non-local, points-to NULL, points-to vars: { x }" "alias" } } */
/* { dg-final { cleanup-tree-dump "alias" } } */ /* { dg-final { cleanup-tree-dump "alias" } } */
...@@ -34,5 +34,5 @@ int main() ...@@ -34,5 +34,5 @@ int main()
return 0; return 0;
} }
/* { dg-final { scan-tree-dump "ESCAPED, points-to non-local, points-to vars: { x }" "alias" } } */ /* { dg-final { scan-tree-dump "ESCAPED, points-to non-local, points-to NULL, points-to vars: { x }" "alias" } } */
/* { dg-final { cleanup-tree-dump "alias" } } */ /* { dg-final { cleanup-tree-dump "alias" } } */
...@@ -38,5 +38,5 @@ int main() ...@@ -38,5 +38,5 @@ int main()
return 0; return 0;
} }
/* { dg-final { scan-tree-dump "ESCAPED, points-to non-local, points-to vars: { x }" "alias" } } */ /* { dg-final { scan-tree-dump "ESCAPED, points-to non-local, points-to NULL, points-to vars: { x }" "alias" } } */
/* { dg-final { cleanup-tree-dump "alias" } } */ /* { dg-final { cleanup-tree-dump "alias" } } */
...@@ -11,5 +11,5 @@ NumSift (long *array, unsigned long k) ...@@ -11,5 +11,5 @@ NumSift (long *array, unsigned long k)
/* There should be only two loads left. */ /* There should be only two loads left. */
/* { dg-final { scan-tree-dump-times "= \\\*D" 2 "pre" } } */ /* { dg-final { scan-tree-dump-times "= \\\*D\[^\n;\]*;" 2 "pre" } } */
/* { dg-final { cleanup-tree-dump "pre" } } */ /* { dg-final { cleanup-tree-dump "pre" } } */
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