]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/93439 move clique bookkeeping to OMP expansion
authorRichard Biener <rguenther@suse.de>
Fri, 14 Feb 2020 08:23:06 +0000 (09:23 +0100)
committerRichard Biener <rguenther@suse.de>
Fri, 14 Feb 2020 10:01:50 +0000 (11:01 +0100)
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  <rguenther@suse.de>

Backport from mainline
2020-01-28  Richard Biener  <rguenther@suse.de>

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.

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/graphite/pr93439.f90 [new file with mode: 0644]
gcc/tree-cfg.c
gcc/tree-parloops.c

index e1a1dc41ac0d9e34ee471f12230a54afd781da52..4d1a97e8607d123a0286d92f502585789bcf6a8f 100644 (file)
@@ -1,3 +1,14 @@
+2020-02-14  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2020-01-28  Richard Biener  <rguenther@suse.de>
+
+       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  <rguenther@suse.de>
 
        Backport from mainline
index 81d15a747c955e01be3df703452a8a9dac2af1ec..72036e03c706e966e0ba3a4f863f360c94dfa1d4 100644 (file)
@@ -1,3 +1,11 @@
+2020-02-14  Richard Biener  <rguenther@suse.de>
+
+       Backport from mainline
+       2020-01-28  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/93439
+       * gfortran.dg/graphite/pr93439.f90: New testcase.
+
 2020-02-14  Richard Biener  <rguenther@suse.de>
 
        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 (file)
index 0000000..e815ab9
--- /dev/null
@@ -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
index d27cc65f8837cf54b84b347d8b79236c7ee0b244..0c4ae81aa051c5f17687afb929aba5cd9786eac3 100644 (file)
@@ -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.  */
index c5629cc80896f10d7d0359c3b395b7d05cd905c8..dad6e2884db8a158e140557991f747ed00e1321b 100644 (file)
@@ -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.  */