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