This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Don't ignore failures from compute_data_dependences_for_loop in build_rdg (PR tree-optimization/52835)


On Mon, Apr 2, 2012 at 11:53 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> On the following testcase compute_data_dependences_for_loop
> fails, but build_rdg ignores its return value and happily goes
> on as if it didn't fail, optimizing away a call.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
> ok for trunk/4.7?

Ok.

Thanks,
Richard.

> 2012-04-02 ?Jakub Jelinek ?<jakub@redhat.com>
>
> ? ? ? ?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.
>
> --- gcc/tree-data-ref.c.jj ? ? ?2012-03-20 08:51:32.000000000 +0100
> +++ gcc/tree-data-ref.c 2012-04-02 21:30:13.783378347 +0200
> @@ -5129,20 +5129,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;
> ?}
>
> --- gcc/testsuite/gfortran.dg/pr52835.f90.jj ? ?2012-04-02 21:35:42.616505464 +0200
> +++ gcc/testsuite/gfortran.dg/pr52835.f90 ? ? ? 2012-04-02 21:35:08.000000000 +0200
> @@ -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" } }
>
> ? ? ? ?Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]