omp-low.c (lower_rec_simd_input_clauses): Set TREE_THIS_NOTRAP on ivar and lvar.
authorJakub Jelinek <jakub@redhat.com>
Fri, 31 May 2019 21:37:10 +0000 (23:37 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 31 May 2019 21:37:10 +0000 (23:37 +0200)
* omp-low.c (lower_rec_simd_input_clauses): Set TREE_THIS_NOTRAP on
ivar and lvar.

* gcc.dg/vect/vect-simd-5.c: New test.

From-SVN: r271824

gcc/ChangeLog
gcc/omp-low.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/vect-simd-5.c [new file with mode: 0644]

index 29c8ecca5cf5c3d4c11ab4fb3a69ef1667ced48f..3693ae605ca9eba03251ed3828398dd72f6bbac6 100644 (file)
@@ -1,3 +1,8 @@
+2019-05-31  Jakub Jelinek  <jakub@redhat.com>
+
+       * omp-low.c (lower_rec_simd_input_clauses): Set TREE_THIS_NOTRAP on
+       ivar and lvar.
+
 2019-05-31  Xiong Hu Luo  <luoxhu@linux.ibm.com>
 
        PR c/43673
index d200005dc2841242a4224cc10830e9e6b5209102..1e47a36c5342e97a24b04de6a3f2b7f700b1369f 100644 (file)
@@ -3728,6 +3728,8 @@ lower_rec_simd_input_clauses (tree new_var, omp_context *ctx,
                     NULL_TREE, NULL_TREE);
       lvar = build4 (ARRAY_REF, TREE_TYPE (new_var), avar, sctx->lane,
                     NULL_TREE, NULL_TREE);
+      TREE_THIS_NOTRAP (ivar) = 1;
+      TREE_THIS_NOTRAP (lvar) = 1;
     }
   if (DECL_P (new_var))
     {
index 9dc9cbc3d32db2cf1bd6f1ae0abd7ee45d7e900a..fac9f2e2869d732c31d67d19c770d13deff2435d 100644 (file)
@@ -1,3 +1,7 @@
+2019-05-31  Jakub Jelinek  <jakub@redhat.com>
+
+       * gcc.dg/vect/vect-simd-5.c: New test.
+
 2019-05-31  Xiong Hu Luo  <luoxhu@linux.ibm.com>
 
        PR c/43673
diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-5.c b/gcc/testsuite/gcc.dg/vect/vect-simd-5.c
new file mode 100644 (file)
index 0000000..bacb247
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fopenmp-simd" } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_condition } } } */
+
+int x;
+
+void
+foo (int *a)
+{
+  #pragma omp simd lastprivate (x)
+  for (int i = 0; i < 1024; ++i)
+    if (a[i])
+      x = i;
+}