1 // RUN: %clang_cc1 -no-opaque-pointers -verify -fopenmp -x c++ -triple x86_64-unknown-linux -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s 2 // RUN: %clang_cc1 -no-opaque-pointers -verify -fopenmp -x c++ -triple aarch64-unknown-linux -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s 3 // RUN: %clang_cc1 -no-opaque-pointers -verify -fopenmp -x c++ -triple ppc64le-unknown-linux -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s 4 // expected-no-diagnostics 5 6 #ifndef HEADER 7 #define HEADER 8 9 #define N 1000 10 void func() { 11 // Test where a valid when clause contains empty directive. 12 // The directive will be ignored and code for a serial for loop will be generated. 13 #pragma omp metadirective when(implementation = {vendor(llvm)} \ 14 :) default(parallel for) 15 for (int i = 0; i < N; i++) 16 ; 17 } 18 19 // CHECK-LABEL: void @_Z4funcv() 20 // CHECK: entry: 21 // CHECK: [[I:%.+]] = alloca i32, 22 // CHECK: store i32 0, i32* [[I]], 23 // CHECK: br label %[[FOR_COND:.+]] 24 // CHECK: [[FOR_COND]]: 25 // CHECK: [[ZERO:%.+]] = load i32, i32* [[I]], 26 // CHECK: [[CMP:%.+]] = icmp slt i32 [[ZERO]], 1000 27 // CHECK: br i1 [[CMP]], label %[[FOR_BODY:.+]], label %[[FOR_END:.+]] 28 // CHECK: [[FOR_BODY]]: 29 // CHECK: br label %[[FOR_INC:.+]] 30 // CHECK: [[FOR_INC]]: 31 // CHECK: [[ONE:%.+]] = load i32, i32* [[I]], 32 // CHECK: [[INC:%.+]] = add nsw i32 [[ONE]], 1 33 // CHECK: store i32 [[INC]], i32* [[I]], 34 // CHECK: br label %[[FOR_COND]], 35 // CHECK: [[FOR_END]]: 36 // CHECK: ret void 37 // CHECK: } 38 39 #endif 40