summaryrefslogtreecommitdiffstats
path: root/clang/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
commit36bf011e8348263c5b375a8def38bc6569ee6fb7 (patch)
tree8c25cdd60a9ef729aace2833590d262396c8a4df /clang/test/OpenMP/critical_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/critical_codegen.cpp')
-rw-r--r--clang/test/OpenMP/critical_codegen.cpp27
1 files changed, 19 insertions, 8 deletions
diff --git a/clang/test/OpenMP/critical_codegen.cpp b/clang/test/OpenMP/critical_codegen.cpp
index 37a062d71ab..6384612c8e6 100644
--- a/clang/test/OpenMP/critical_codegen.cpp
+++ b/clang/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
OpenPOWER on IntegriCloud