summaryrefslogtreecommitdiffstats
path: root/clang/test/OpenMP/openmp_win_codegen.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2017-11-02 14:25:34 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2017-11-02 14:25:34 +0000
commit0e1b45897ec9ac5de93a578edfe55021eb64bf5c (patch)
tree7ce91106f740ad548aa05a386acfd900d9778f2e /clang/test/OpenMP/openmp_win_codegen.cpp
parent96087f38254ac1a655ceaea816937323b13e0dcf (diff)
downloadbcm5719-llvm-0e1b45897ec9ac5de93a578edfe55021eb64bf5c.tar.gz
bcm5719-llvm-0e1b45897ec9ac5de93a578edfe55021eb64bf5c.zip
[OPENMP] Fix PR35156: Get correct thread id with windows exceptions.
If the thread id is requested in windows mode within funclets, we may generate incorrect function call that could lead to broken codegen. llvm-svn: 317208
Diffstat (limited to 'clang/test/OpenMP/openmp_win_codegen.cpp')
-rw-r--r--clang/test/OpenMP/openmp_win_codegen.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/clang/test/OpenMP/openmp_win_codegen.cpp b/clang/test/OpenMP/openmp_win_codegen.cpp
new file mode 100644
index 00000000000..cdad7e29ccb
--- /dev/null
+++ b/clang/test/OpenMP/openmp_win_codegen.cpp
@@ -0,0 +1,38 @@
+// 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 - | FileCheck %s
+// REQUIRES: x86-registered-target
+// expected-no-diagnostics
+
+void foo();
+void bar();
+
+// CHECK-LABEL: @main
+int 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
+
OpenPOWER on IntegriCloud