From: Richard Biener Date: Fri, 14 Feb 2020 08:23:06 +0000 (+0100) Subject: tree-optimization/93439 move clique bookkeeping to OMP expansion X-Git-Tag: releases/gcc-9.3.0~127 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03d2b1d79740c5b2d05bbf84af2dbaf2e1e80ebb;p=thirdparty%2Fgcc.git tree-optimization/93439 move clique bookkeeping to OMP expansion Autopar was doing clique bookkeeping too early when creating destination functions but then later introducing new cliques via versioning loops. The following moves the bookkeeping to the actual outlining process. 2020-02-14 Richard Biener Backport from mainline 2020-01-28 Richard Biener PR tree-optimization/93439 * tree-parloops.c (create_loop_fn): Move clique bookkeeping... * tree-cfg.c (move_sese_region_to_fn): ... here. (verify_types_in_gimple_reference): Verify used cliques are tracked. * gfortran.dg/graphite/pr93439.f90: New testcase. --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e1a1dc41ac0d..4d1a97e8607d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2020-02-14 Richard Biener + + Backport from mainline + 2020-01-28 Richard Biener + + PR tree-optimization/93439 + * tree-parloops.c (create_loop_fn): Move clique bookkeeping... + * tree-cfg.c (move_sese_region_to_fn): ... here. + (verify_types_in_gimple_reference): Verify used cliques are + tracked. + 2020-02-14 Richard Biener Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 81d15a747c95..72036e03c706 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2020-02-14 Richard Biener + + Backport from mainline + 2020-01-28 Richard Biener + + PR tree-optimization/93439 + * gfortran.dg/graphite/pr93439.f90: New testcase. + 2020-02-14 Richard Biener Backport from mainline diff --git a/gcc/testsuite/gfortran.dg/graphite/pr93439.f90 b/gcc/testsuite/gfortran.dg/graphite/pr93439.f90 new file mode 100644 index 000000000000..e815ab929e15 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/graphite/pr93439.f90 @@ -0,0 +1,21 @@ +! { dg-additional-options "-O2 -floop-parallelize-all -floop-unroll-and-jam -ftree-parallelize-loops=2" } + +module ai + integer, parameter :: dp = 8 +contains + subroutine qu(ja, nq, en, p5) + real(kind = dp) :: nq(ja), en(ja), p5(ja) + call tl(ja, nq, en, p5) + end subroutine qu + + subroutine tl(ja, nq, en, p5) + real(kind = dp) :: nq(9), en(9 * ja), p5(3 * ja) + do mc = 1, ja + do mb = 1, 9 + do ma = 1, 3 + p5((mc - 1) * 3 + ma) = p5((mc - 1) * 3 + ma) - 1 + end do + end do + end do + end subroutine tl +end module ai diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index d27cc65f8837..0c4ae81aa051 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -3215,6 +3215,13 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue) debug_generic_stmt (expr); return true; } + if (MR_DEPENDENCE_CLIQUE (expr) != 0 + && MR_DEPENDENCE_CLIQUE (expr) > cfun->last_clique) + { + error ("invalid clique in MEM_REF"); + debug_generic_stmt (expr); + return true; + } } else if (TREE_CODE (expr) == TARGET_MEM_REF) { @@ -3234,6 +3241,13 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue) debug_generic_stmt (expr); return true; } + if (MR_DEPENDENCE_CLIQUE (expr) != 0 + && MR_DEPENDENCE_CLIQUE (expr) > cfun->last_clique) + { + error ("invalid clique in TARGET_MEM_REF"); + debug_generic_stmt (expr); + return true; + } } else if (TREE_CODE (expr) == INDIRECT_REF) { @@ -7677,6 +7691,9 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, after = bb; } + /* Adjust the maximum clique used. */ + dest_cfun->last_clique = saved_cfun->last_clique; + loop->aux = NULL; loop0->aux = NULL; /* Loop sizes are no longer correct, fix them up. */ diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index c5629cc80896..dad6e2884db8 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -1498,7 +1498,6 @@ create_loop_fn (location_t loc) DECL_ARGUMENTS (decl) = t; allocate_struct_function (decl, false); - DECL_STRUCT_FUNCTION (decl)->last_clique = act_cfun->last_clique; /* The call to allocate_struct_function clobbers CFUN, so we need to restore it. */