summaryrefslogtreecommitdiffstats
path: root/test/OpenMP/openmp_win_codegen.cpp
diff options
context:
space:
mode:
authorDavid L. Jones <dlj@google.com>2017-11-15 01:40:05 +0000
committerDavid L. Jones <dlj@google.com>2017-11-15 01:40:05 +0000
commitfdfce82b87b73e18577d493e84bdabe2585b95d0 (patch)
treee8d9290e273dba03920bf15a8c7742fcf5ed0b87 /test/OpenMP/openmp_win_codegen.cpp
parent41af1698c520ea38edf83e7c91f1e519d34f20c1 (diff)
parenta7540887e8b5cb34ee28c12bef863bad85c65b6f (diff)
Creating branches/google/testing and tags/google/testing/2017-11-14 from r317716upstream/google/testing
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/google/testing@318248 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/OpenMP/openmp_win_codegen.cpp')
-rw-r--r--test/OpenMP/openmp_win_codegen.cpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/test/OpenMP/openmp_win_codegen.cpp b/test/OpenMP/openmp_win_codegen.cpp
new file mode 100644
index 0000000000..45b2c185cb
--- /dev/null
+++ b/test/OpenMP/openmp_win_codegen.cpp
@@ -0,0 +1,61 @@
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-pc-windows-msvc18.0.0 -std=c++11 -fms-compatibility-version=18 -fms-extensions -emit-llvm %s -fexceptions -fcxx-exceptions -o - -O1 | FileCheck %s
+// REQUIRES: x86-registered-target
+// expected-no-diagnostics
+
+void foo();
+void bar();
+
+struct Test {
+ static void main() {
+ int failed = 0;
+ int j = 2;
+
+#pragma omp parallel
+ {
+ int local_j = 3;
+#pragma omp single copyprivate(local_j)
+ {
+ local_j = 4;
+ }
+
+ // Assure reports a data race, but value written to "j"
+ // should always be the same.
+ j = local_j;
+ }
+
+ }
+};
+
+// CHECK-LABEL: @main
+int main() {
+ // CHECK: call void @{{.+}}main
+ Test::main();
+ // CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%ident_t* {{.*}}@0, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* [[OUTLINED:@.+]] to void (i32*, i32*, ...)*))
+#pragma omp parallel
+ {
+ try {
+ foo();
+ } catch (int t) {
+#pragma omp critical
+ {
+ bar();
+ };
+ }
+ };
+ // CHECK: ret i32 0
+ return 0;
+}
+
+// CHECK: define internal void [[OUTLINED]](
+// CHECK: [[GID:%.+]] = {{.*}}call i32 @__kmpc_global_thread_num(%ident_t* {{.*}}@0)
+// CHECK: invoke void @{{.+}}foo
+// CHECK: catchswitch within
+// CHECK: catchpad within
+// CHECK: call void @__kmpc_critical(%ident_t* {{.*}}@0, i32 [[GID]],
+// CHECK: invoke void @{{.+}}bar
+// CHECK: call void @__kmpc_end_critical(%ident_t* {{.*}}@0, i32 [[GID]],
+// CHECK: catchret from
+// CHECK: cleanuppad within
+// CHECK: call void @__kmpc_end_critical(%ident_t* {{.*}}@0, i32 [[GID]],
+// CHECK: cleanupret from
+