]> gcc.gnu.org Git - gcc.git/commitdiff
backport: re PR tree-optimization/88107 (ICE in find_outermost_region_in_block, at...
authorJakub Jelinek <jakub@redhat.com>
Fri, 30 Aug 2019 11:35:08 +0000 (13:35 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 30 Aug 2019 11:35:08 +0000 (13:35 +0200)
Backported from mainline
2019-02-01  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/88107
* tree-cfg.c (find_outermost_region_in_block): Add ALL argument,
instead of assertion that eh_region_outermost is non-NULL, if it
is NULL, set *ALL to true and return NULL.
(move_sese_region_to_fn): Adjust caller, if all is set, call
duplicate_eh_regions with NULL region.

* gcc.dg/gomp/pr88107.c: New test.

From-SVN: r275095

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/gomp/pr88107.c [new file with mode: 0644]
gcc/tree-cfg.c

index 3747d5d57ea95b2a57938d2f170c678653edadbc..135034119acf1980805d19b6ca737e66d2ebd993 100644 (file)
@@ -1,6 +1,15 @@
 2019-08-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-02-01  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/88107
+       * tree-cfg.c (find_outermost_region_in_block): Add ALL argument,
+       instead of assertion that eh_region_outermost is non-NULL, if it
+       is NULL, set *ALL to true and return NULL.
+       (move_sese_region_to_fn): Adjust caller, if all is set, call
+       duplicate_eh_regions with NULL region.
+
        2019-01-29  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/66676
index d3d1d59c42cc1e3f2bc0fa3107f3406bb8200abf..b11b037af3f6766f1bdfd0237de87197da016e47 100644 (file)
@@ -1,6 +1,11 @@
 2019-08-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-02-01  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/88107
+       * gcc.dg/gomp/pr88107.c: New test.
+
        2019-01-29  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/66676
diff --git a/gcc/testsuite/gcc.dg/gomp/pr88107.c b/gcc/testsuite/gcc.dg/gomp/pr88107.c
new file mode 100644 (file)
index 0000000..3b53b56
--- /dev/null
@@ -0,0 +1,35 @@
+/* PR tree-optimization/88107 */
+/* { dg-do compile { target fgraphite } } */
+/* { dg-require-effective-target vect_simd_clones } */
+/* { dg-options "-O2 -fexceptions -floop-nest-optimize -fnon-call-exceptions -fopenmp-simd -ftree-parallelize-loops=2" } */
+
+#define N 1024
+int a[N], b[N];
+long int c[N];
+unsigned char d[N];
+
+#pragma omp declare simd notinbranch
+__attribute__((noinline)) static int
+foo (long int a, int b, int c)
+{
+  return a + b + c;
+}
+
+#pragma omp declare simd notinbranch
+__attribute__((noinline)) static long int
+bar (int a, int b, long int c)
+{
+  return a + b + c;
+}
+
+void
+baz (void)
+{
+  int i;
+  #pragma omp simd
+  for (i = 0; i < N; i++)
+    a[i] = foo (c[i], a[i], b[i]) + 6;
+  #pragma omp simd
+  for (i = 0; i < N; i++)
+    c[i] = bar (a[i], b[i], c[i]) * 2;
+}
index f9d75c5f64dba93d3f7460afa7156308af1f0319..c223ee45be2377511f5a9e01ae3ce5ede7e5e225 100644 (file)
@@ -7002,11 +7002,14 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb,
 }
 
 /* Examine the statements in BB (which is in SRC_CFUN); find and return
-   the outermost EH region.  Use REGION as the incoming base EH region.  */
+   the outermost EH region.  Use REGION as the incoming base EH region.
+   If there is no single outermost region, return NULL and set *ALL to
+   true.  */
 
 static eh_region
 find_outermost_region_in_block (struct function *src_cfun,
-                               basic_block bb, eh_region region)
+                               basic_block bb, eh_region region,
+                               bool *all)
 {
   gimple_stmt_iterator si;
 
@@ -7025,7 +7028,11 @@ find_outermost_region_in_block (struct function *src_cfun,
          else if (stmt_region != region)
            {
              region = eh_region_outermost (src_cfun, stmt_region, region);
-             gcc_assert (region != NULL);
+             if (region == NULL)
+               {
+                 *all = true;
+                 return NULL;
+               }
            }
        }
     }
@@ -7319,12 +7326,17 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb,
   if (saved_cfun->eh)
     {
       eh_region region = NULL;
+      bool all = false;
 
       FOR_EACH_VEC_ELT (bbs, i, bb)
-       region = find_outermost_region_in_block (saved_cfun, bb, region);
+       {
+         region = find_outermost_region_in_block (saved_cfun, bb, region, &all);
+         if (all)
+           break;
+       }
 
       init_eh_for_function ();
-      if (region != NULL)
+      if (region != NULL || all)
        {
          new_label_map = htab_create (17, tree_map_hash, tree_map_eq, free);
          eh_map = duplicate_eh_regions (saved_cfun, region, 0,
This page took 0.103069 seconds and 5 git commands to generate.