re PR middle-end/52835 (-O3 wrongly optimizes loop __builtin_memcpy away)

PR tree-optimization/52835
	* tree-data-ref.c (build_rdg): Return NULL if
	compute_data_dependences_for_loop failed.

	* gfortran.dg/pr52835.f90: New test.

From-SVN: r186103
This commit is contained in:
Jakub Jelinek 2012-04-03 11:05:00 +02:00 committed by Jakub Jelinek
parent 7a2e5bc65d
commit f5acdedf58
4 changed files with 32 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2012-04-03 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/52835
* tree-data-ref.c (build_rdg): Return NULL if
compute_data_dependences_for_loop failed.
2012-03-31 Eric Botcazou <ebotcazou@adacore.com>
* tree-cfg.c (call_can_make_abnormal_goto): New predicate.

View File

@ -1,3 +1,8 @@
2012-04-03 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/52835
* gfortran.dg/pr52835.f90: New test.
2012-03-31 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/controlled6.adb: New test.

View File

@ -0,0 +1,16 @@
! PR tree-optimization/52835
! { dg-do compile }
! { dg-options "-O3 -fdump-tree-optimized" }
subroutine foo (x, y, z, n)
integer :: n, i
real :: x(n), y(n), z(n)
do i = 1, n
z(i) = 0.0
y(i) = 0.0
call bar (y(i), z(i), x(i))
end do
end subroutine
! { dg-final { scan-tree-dump "bar " "optimized" } }
! { dg-final { cleanup-tree-dump "optimized" } }

View File

@ -5075,20 +5075,19 @@ build_rdg (struct loop *loop,
VEC (data_reference_p, heap) **datarefs)
{
struct graph *rdg = NULL;
VEC (gimple, heap) *stmts = VEC_alloc (gimple, heap, 10);
compute_data_dependences_for_loop (loop, false, loop_nest, datarefs,
dependence_relations);
if (known_dependences_p (*dependence_relations))
if (compute_data_dependences_for_loop (loop, false, loop_nest, datarefs,
dependence_relations)
&& known_dependences_p (*dependence_relations))
{
VEC (gimple, heap) *stmts = VEC_alloc (gimple, heap, 10);
stmts_from_loop (loop, &stmts);
rdg = build_empty_rdg (VEC_length (gimple, stmts));
create_rdg_vertices (rdg, stmts);
create_rdg_edges (rdg, *dependence_relations);
VEC_free (gimple, heap, stmts);
}
VEC_free (gimple, heap, stmts);
return rdg;
}