summaryrefslogtreecommitdiffstats
path: root/clang/test/OpenMP/atomic_codegen.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2015-03-10 05:15:26 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2015-03-10 05:15:26 +0000
commit36bf011e8348263c5b375a8def38bc6569ee6fb7 (patch)
tree8c25cdd60a9ef729aace2833590d262396c8a4df /clang/test/OpenMP/atomic_codegen.cpp
parent81ad639ed3cc4ddd957c28cf15c344796c560efd (diff)
downloadbcm5719-llvm-36bf011e8348263c5b375a8def38bc6569ee6fb7.tar.gz
bcm5719-llvm-36bf011e8348263c5b375a8def38bc6569ee6fb7.zip
[OPENMP] Improved code for generating debug info + generation of all OpenMP regions in termination scope
Patch adds proper generation of debug info for all OpenMP regions. Also, all OpenMP regions are generated in a termination scope, because standard does not allow to throw exceptions out of structured blocks, associated with the OpenMP regions Differential Revision: http://reviews.llvm.org/D7935 llvm-svn: 231757
Diffstat (limited to 'clang/test/OpenMP/atomic_codegen.cpp')
-rw-r--r--clang/test/OpenMP/atomic_codegen.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/clang/test/OpenMP/atomic_codegen.cpp b/clang/test/OpenMP/atomic_codegen.cpp
new file mode 100644
index 00000000000..1ceb8638617
--- /dev/null
+++ b/clang/test/OpenMP/atomic_codegen.cpp
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp=libiomp5 -fexceptions -fcxx-exceptions -gline-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG
+// expected-no-diagnostics
+
+int a;
+int &foo() { return a; }
+
+// TERM_DEBUG-LABEL: parallel_atomic
+void parallel_atomic() {
+#pragma omp parallel
+ {
+#pragma omp atomic read
+ // TERM_DEBUG-NOT: __kmpc_global_thread_num
+ // TERM_DEBUG: invoke {{.*}}foo{{.*}}()
+ // TERM_DEBUG: unwind label %[[TERM_LPAD:.+]],
+ // TERM_DEBUG: load atomic i32, i32* @{{.+}} monotonic, {{.*}}!dbg [[READ_LOC:![0-9]+]]
+ foo() = a;
+#pragma omp atomic write
+ // TERM_DEBUG-NOT: __kmpc_global_thread_num
+ // TERM_DEBUG: invoke {{.*}}foo{{.*}}()
+ // TERM_DEBUG: unwind label %[[TERM_LPAD:.+]],
+ // TERM_DEBUG-NOT: __kmpc_global_thread_num
+ // TERM_DEBUG: store atomic i32 {{%.+}}, i32* @{{.+}} monotonic, {{.*}}!dbg [[WRITE_LOC:![0-9]+]]
+ // TERM_DEBUG: [[TERM_LPAD]]:
+ // TERM_DEBUG: call void @__clang_call_terminate
+ // TERM_DEBUG: unreachable
+ a = foo();
+ }
+}
+// TERM_DEBUG-DAG: [[READ_LOC]] = !MDLocation(line: 11,
+// TERM_DEBUG-DAG: [[WRITE_LOC]] = !MDLocation(line: 17,
OpenPOWER on IntegriCloud