1 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s 2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -emit-pch -o %t %s 3 // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s 4 // expected-no-diagnostics 5 // REQUIRES: x86-registered-target 6 #ifndef HEADER 7 #define HEADER 8 9 // CHECK: [[IDENT_T:%.+]] = type { i32, i32, i32, i32, i8* } 10 // CHECK-DAG: [[EXPLICIT_BARRIER_LOC:@.+]] = {{.+}} [[IDENT_T]] { i32 0, i32 34, i32 0, i32 0, i8* getelementptr inbounds ([{{[0-9]+}} x i8], [{{[0-9]+}} x i8]* @{{.+}}, i32 0, i32 0) } 11 // CHECK-DAG: [[LOC:@.+]] = {{.+}} [[IDENT_T]] { i32 0, i32 2, i32 0, i32 0, i8* getelementptr inbounds ([{{[0-9]+}} x i8], [{{[0-9]+}} x i8]* @{{.+}}, i32 0, i32 0) } 12 13 void foo() {} 14 15 template <class T> 16 T tmain(T argc) { 17 static T a; 18 #pragma omp barrier 19 return a + argc; 20 } 21 22 // CHECK-LABEL: @main 23 int main(int argc, char **argv) { 24 static int a; 25 #pragma omp barrier 26 // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T]]* [[LOC]]) 27 // CHECK: call void @__kmpc_barrier([[IDENT_T]]* [[EXPLICIT_BARRIER_LOC]], i32 [[GTID]]) 28 // CHECK: call {{.+}} [[TMAIN_INT:@.+]](i{{[0-9][0-9]}} 29 // CHECK: call {{.+}} [[TMAIN_CHAR:@.+]](i{{[0-9]}} 30 return tmain(argc) + tmain(argv[0][0]) + a; 31 } 32 33 // CHECK: define {{.+}} [[TMAIN_INT]]( 34 // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T]]* [[LOC]]) 35 // CHECK: call void @__kmpc_barrier([[IDENT_T]]* [[EXPLICIT_BARRIER_LOC]], i32 [[GTID]]) 36 37 // CHECK: define {{.+}} [[TMAIN_CHAR]]( 38 // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T]]* [[LOC]]) 39 // CHECK: call void @__kmpc_barrier([[IDENT_T]]* [[EXPLICIT_BARRIER_LOC]], i32 [[GTID]]) 40 41 #endif 42