]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/60682 ([OpenMP] ICE on an assignment of local variable inside SIMD...
authorJakub Jelinek <jakub@redhat.com>
Thu, 27 Mar 2014 13:18:52 +0000 (14:18 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 27 Mar 2014 13:18:52 +0000 (14:18 +0100)
PR middle-end/60682
* omp-low.c (lower_omp_1): For gimple_clobber_p stmts,
if they need regimplification, just drop them instead of
calling gimple_regimplify_operands on them.

* g++.dg/gomp/pr60682.C: New test.

From-SVN: r208864

gcc/ChangeLog
gcc/omp-low.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/gomp/pr60682.C [new file with mode: 0644]

index fcec2ad3aab671d74a98043b3301c466d9c55773..fb6181277c50c736c873e43535d2933946ff52ee 100644 (file)
@@ -1,3 +1,10 @@
+2014-03-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/60682
+       * omp-low.c (lower_omp_1): For gimple_clobber_p stmts,
+       if they need regimplification, just drop them instead of
+       calling gimple_regimplify_operands on them.
+
 2014-03-27  Marcus Shawcroft  <marcus.shawcroft@arm.com>
 
        PR target/60580
index 7cc398ea5c099d975ac366de46fd6cde3021f0b5..11bb2d35a151aa0b563254d2148d00fd163f466a 100644 (file)
@@ -10124,7 +10124,20 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx)
       if ((ctx || task_shared_vars)
          && walk_gimple_op (stmt, lower_omp_regimplify_p,
                             ctx ? NULL : &wi))
-       gimple_regimplify_operands (stmt, gsi_p);
+       {
+         /* Just remove clobbers, this should happen only if we have
+            "privatized" local addressable variables in SIMD regions,
+            the clobber isn't needed in that case and gimplifying address
+            of the ARRAY_REF into a pointer and creating MEM_REF based
+            clobber would create worse code than we get with the clobber
+            dropped.  */
+         if (gimple_clobber_p (stmt))
+           {
+             gsi_replace (gsi_p, gimple_build_nop (), true);
+             break;
+           }
+         gimple_regimplify_operands (stmt, gsi_p);
+       }
       break;
     }
 }
index fd9149e9cbd330e92ea73a0b922d801fba16d115..c2a13d94931324148ba1a6c61ee20391939c31cf 100644 (file)
@@ -1,3 +1,8 @@
+2014-03-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/60682
+       * g++.dg/gomp/pr60682.C: New test.
+
 2014-03-27  John David Anglin  <danglin@gcc.gnu.org>
 
        * gcc.dg/torture/pr60092.c: Remove default dg-skip-if arguments.
diff --git a/gcc/testsuite/g++.dg/gomp/pr60682.C b/gcc/testsuite/g++.dg/gomp/pr60682.C
new file mode 100644 (file)
index 0000000..fdd7a20
--- /dev/null
@@ -0,0 +1,44 @@
+// PR middle-end/60682
+// { dg-do compile }
+// { dg-options "-O2 -fopenmp-simd" }
+
+struct A
+{
+  float a;
+  A () {}
+  A (const A &x) { a = x.a; }
+};
+
+struct B
+{
+  A a[16];
+};
+
+struct C
+{
+  float a[1];
+  C () {}
+  C (const C &x) { a[0] = x.a[0]; }
+};
+
+struct D
+{
+  C a[16];
+};
+
+void
+foo (int x, B &y, D &z)
+{
+#pragma omp simd
+  for (int i = 0; i < x; ++i)
+    {
+      A a;
+      y.a[i] = a;
+    }
+#pragma omp simd
+  for (int i = 0; i < x; ++i)
+    {
+      C a;
+      z.a[i] = a;
+    }
+}