• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -verify -fopenmp -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
4 // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -debug-info-kind=line-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG
5 // expected-no-diagnostics
6 // REQUIRES: x86-registered-target
7 #ifndef HEADER
8 #define HEADER
9 
10 // CHECK:       [[IDENT_T_TY:%.+]] = type { i32, i32, i32, i32, i8* }
11 
12 // CHECK:       define {{.*}}void [[FOO:@.+]]()
13 
foo()14 void foo() {}
15 
16 // CHECK-LABEL: @main
17 // TERM_DEBUG-LABEL: @main
main()18 int main() {
19 // CHECK:       [[A_ADDR:%.+]] = alloca i8
20   char a;
21 
22 // CHECK:       [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:@.+]])
23 // CHECK:       call {{.*}}void @__kmpc_taskgroup([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]])
24 // CHECK-NEXT:  store i8 2, i8* [[A_ADDR]]
25 // CHECK-NEXT:  call {{.*}}void @__kmpc_end_taskgroup([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]])
26 #pragma omp taskgroup
27   a = 2;
28 // CHECK:       call {{.*}}void @__kmpc_taskgroup([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]])
29 // CHECK-NEXT:  invoke {{.*}}void [[FOO]]()
30 // CHECK:       call {{.*}}void @__kmpc_end_taskgroup([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]])
31 #pragma omp taskgroup
32   foo();
33 // CHECK-NOT:   call {{.*}}void @__kmpc_taskgroup
34 // CHECK-NOT:   call {{.*}}void @__kmpc_end_taskgroup
35 // CHECK:       ret
36   return a;
37 }
38 
39 // CHECK-LABEL:      parallel_taskgroup
40 // TERM_DEBUG-LABEL: parallel_taskgroup
parallel_taskgroup()41 void parallel_taskgroup() {
42 #pragma omp parallel
43 #pragma omp taskgroup
44   // TERM_DEBUG-NOT: __kmpc_global_thread_num
45   // TERM_DEBUG:     call void @__kmpc_taskgroup({{.+}}), !dbg [[DBG_LOC_START:![0-9]+]]
46   // TERM_DEBUG:     invoke void {{.*}}foo{{.*}}()
47   // TERM_DEBUG:     unwind label %[[TERM_LPAD:.+]],
48   // TERM_DEBUG-NOT: __kmpc_global_thread_num
49   // TERM_DEBUG:     call void @__kmpc_end_taskgroup({{.+}}), !dbg [[DBG_LOC_END:![0-9]+]]
50   // TERM_DEBUG:     [[TERM_LPAD]]
51   // TERM_DEBUG:     call void @__clang_call_terminate
52   // TERM_DEBUG:     unreachable
53   foo();
54 }
55 // TERM_DEBUG-DAG: [[DBG_LOC_START]] = !DILocation(line: [[@LINE-12]],
56 // TERM_DEBUG-DAG: [[DBG_LOC_END]] = !DILocation(line: [[@LINE-3]],
57 #endif
58