summaryrefslogtreecommitdiffstats
path: root/test/OpenMP/critical_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
commita2f6296c3e698b6b8e674ae267bde8a50e38b7c9 (patch)
tree9aaaea8c6787852dbebb636c31b12db0638b6f35 /test/OpenMP/critical_codegen.cpp
parentda271fc0b8e0a42df1d7f323be719cb72d053675 (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@231757 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/OpenMP/critical_codegen.cpp')
-rw-r--r--test/OpenMP/critical_codegen.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/test/OpenMP/critical_codegen.cpp b/test/OpenMP/critical_codegen.cpp
index 37a062d71a..6384612c8e 100644
--- a/test/OpenMP/critical_codegen.cpp
+++ b/test/OpenMP/critical_codegen.cpp
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s
// RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
// RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
+// 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
#ifndef HEADER
@@ -15,6 +16,7 @@
void foo() {}
// CHECK-LABEL: @main
+// TERM_DEBUG-LABEL: @main
int main() {
// CHECK: [[A_ADDR:%.+]] = alloca i8
char a;
@@ -26,8 +28,8 @@ int main() {
#pragma omp critical
a = 2;
// CHECK: call void @__kmpc_critical([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], [8 x i32]* [[THE_NAME_LOCK]])
-// CHECK-NEXT: call void [[FOO]]()
-// CHECK-NEXT: call void @__kmpc_end_critical([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], [8 x i32]* [[THE_NAME_LOCK]])
+// CHECK-NEXT: invoke void [[FOO]]()
+// CHECK: call void @__kmpc_end_critical([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], [8 x i32]* [[THE_NAME_LOCK]])
#pragma omp critical(the_name)
foo();
// CHECK-NOT: call void @__kmpc_critical
@@ -35,13 +37,22 @@ int main() {
return a;
}
-// CHECK-LABEL: parallel_critical
-void parallel_critical(float *a) {
+// CHECK-LABEL: parallel_critical
+// TERM_DEBUG-LABEL: parallel_critical
+void parallel_critical() {
#pragma omp parallel
#pragma omp critical
- // CHECK-NOT: __kmpc_global_thread_num
- for (unsigned i = 131071; i <= 2147483647; i += 127)
- a[i] += i;
+ // TERM_DEBUG-NOT: __kmpc_global_thread_num
+ // TERM_DEBUG: call void @__kmpc_critical({{.+}}), !dbg [[DBG_LOC_START:![0-9]+]]
+ // TERM_DEBUG: invoke void {{.*}}foo{{.*}}()
+ // TERM_DEBUG: unwind label %[[TERM_LPAD:.+]],
+ // TERM_DEBUG-NOT: __kmpc_global_thread_num
+ // TERM_DEBUG: call void @__kmpc_end_critical({{.+}}), !dbg [[DBG_LOC_END:![0-9]+]]
+ // TERM_DEBUG: [[TERM_LPAD]]:
+ // TERM_DEBUG: call void @__clang_call_terminate
+ // TERM_DEBUG: unreachable
+ foo();
}
-
+// TERM_DEBUG-DAG: [[DBG_LOC_START]] = !MDLocation(line: 44,
+// TERM_DEBUG-DAG: [[DBG_LOC_END]] = !MDLocation(line: 44,
#endif