summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorTom Stellard <tstellar@redhat.com>2017-11-14 00:18:14 +0000
committerTom Stellard <tstellar@redhat.com>2017-11-14 00:18:14 +0000
commitad3bdffa2fef03257dfe38c9798186bbaaaa7935 (patch)
treec8b00346357f48ded56a4937f9e3d92d1d838cd9 /test
parent519b352e25c984a9807af3f29114e537c9352ff3 (diff)
Merging r315611:
------------------------------------------------------------------------ r315611 | abataev | 2017-10-12 13:03:39 -0700 (Thu, 12 Oct 2017) | 5 lines [OPENMP] Fix PR34927: Emit initializer for reduction array with declare reduction. If the reduction is an array or an array section and reduction operation is declare reduction without initializer, it may lead to crash. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_50@318120 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/OpenMP/declare_reduction_codegen.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/OpenMP/declare_reduction_codegen.cpp b/test/OpenMP/declare_reduction_codegen.cpp
index daa1fe8aaf..ae6e047d94 100644
--- a/test/OpenMP/declare_reduction_codegen.cpp
+++ b/test/OpenMP/declare_reduction_codegen.cpp
@@ -9,6 +9,26 @@
// CHECK: [[SSS_INT:.+]] = type { i32 }
// CHECK-LOAD: [[SSS_INT:.+]] = type { i32 }
+// CHECK: add
+void add(short &out, short &in) {}
+
+#pragma omp declare reduction(my_add : short : add(omp_out, omp_in))
+
+// CHECK: define internal void @.
+// CHECK: call void @{{.+}}add{{.+}}(
+// CHECK: ret void
+
+// CHECK: foo_reduction_array
+void foo_reduction_array() {
+ short y[1];
+ // CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(
+#pragma omp parallel for reduction(my_add : y)
+ for (int i = 0; i < 1; i++) {
+ }
+}
+
+// CHECK: define internal void @
+
#pragma omp declare reduction(+ : int, char : omp_out *= omp_in)
// CHECK: define internal {{.*}}void @{{[^(]+}}(i32* noalias, i32* noalias)
// CHECK: [[MUL:%.+]] = mul nsw i32