1 // RUN: %clang_cc1 -no-opaque-pointers -verify -fopenmp -x c++ -triple x86_64-unknown-linux -emit-llvm %s -fexceptions -fcxx-exceptions -o - -fsanitize-address-use-after-scope | FileCheck %s 2 // RUN: %clang_cc1 -no-opaque-pointers -verify -fopenmp -x c++ -triple aarch64-unknown-linux -emit-llvm %s -fexceptions -fcxx-exceptions -o - -fsanitize-address-use-after-scope | FileCheck %s 3 // RUN: %clang_cc1 -no-opaque-pointers -verify -fopenmp -x c++ -triple ppc64le-unknown-linux -emit-llvm %s -fexceptions -fcxx-exceptions -o - -fsanitize-address-use-after-scope | FileCheck %s 4 5 // expected-no-diagnostics 6 #ifndef HEADER 7 #define HEADER 8 9 void bar(); 10 11 void foo() { 12 #pragma omp metadirective when(device = {kind(any)} \ 13 : parallel) 14 bar(); 15 #pragma omp metadirective when(device = {kind(host, cpu)} \ 16 : parallel for num_threads(4)) 17 for (int i = 0; i < 100; i++) 18 ; 19 #pragma omp metadirective when(device = {kind(host)} \ 20 : parallel for) 21 for (int i = 0; i < 100; i++) 22 ; 23 #pragma omp metadirective when(device = {kind(nohost, gpu)} \ 24 :) when(device = {kind(cpu)} \ 25 : parallel) 26 bar(); 27 #pragma omp metadirective when(device = {kind(any, cpu)} \ 28 : parallel) 29 bar(); 30 #pragma omp metadirective when(device = {kind(any, host)} \ 31 : parallel) 32 bar(); 33 #pragma omp metadirective when(device = {kind(gpu)} \ 34 : target parallel for) default(parallel for) 35 for (int i = 0; i < 100; i++) 36 ; 37 } 38 39 // CHECK-LABEL: define {{.+}} void @_Z3foov() 40 // CHECK: @__kmpc_fork_call(%struct.ident_t* {{.+}}, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* [[OUTLINED_1:@.+]] to void 41 // CHECK-NEXT: @__kmpc_push_num_threads 42 // CHECK: @__kmpc_fork_call(%struct.ident_t* {{.+}}, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* [[OUTLINED_2:@.+]] to void 43 // CHECK: @__kmpc_fork_call(%struct.ident_t* {{.+}}, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* [[OUTLINED_3:@.+]] to void 44 // CHECK: @__kmpc_fork_call(%struct.ident_t* {{.+}}, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* [[OUTLINED_4:@.+]] to void 45 // CHECK: @__kmpc_fork_call(%struct.ident_t* {{.+}}, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* [[OUTLINED_5:@.+]] to void 46 // CHECK: @__kmpc_fork_call(%struct.ident_t* {{.+}}, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* [[OUTLINED_6:@.+]] to void 47 // CHECK: @__kmpc_fork_call(%struct.ident_t* {{.+}}, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* [[OUTLINED_7:@.+]] to void 48 // CHECK: ret void 49 50 // CHECK: define internal void [[OUTLINED_1]]( 51 // CHECK: void @_Z3barv() 52 // CHECK: ret void 53 54 // CHECK: define internal void [[OUTLINED_2]]( 55 // CHECK: call void @__kmpc_for_static_init 56 // CHECK: call void @__kmpc_for_static_fini 57 // CHECK: ret void 58 59 // CHECK: define internal void [[OUTLINED_3]]( 60 // CHECK: call void @__kmpc_for_static_init 61 // CHECK: call void @__kmpc_for_static_fini 62 // CHECK: ret void 63 64 // CHECK: define internal void [[OUTLINED_4]]( 65 // CHECK: void @_Z3barv() 66 // CHECK: ret void 67 68 // CHECK: define internal void [[OUTLINED_5]]( 69 // CHECK: void @_Z3barv() 70 // CHECK: ret void 71 72 // CHECK: define internal void [[OUTLINED_6]]( 73 // CHECK: void @_Z3barv() 74 // CHECK: ret void 75 76 // CHECK: define internal void [[OUTLINED_7]]( 77 // CHECK: call void @__kmpc_for_static_init 78 // CHECK: call void @__kmpc_for_static_fini 79 // CHECK: ret void 80 81 #endif 82