Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / metadirective_empty.cpp
blob8708aa45b15630981286d329b30b7782ebd6ee92
1 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-linux -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s
2 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple aarch64-unknown-linux -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s
3 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple ppc64le-unknown-linux -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s
4 // expected-no-diagnostics
6 #ifndef HEADER
7 #define HEADER
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++)
19 // CHECK-LABEL: void @_Z4funcv()
20 // CHECK: entry:
21 // CHECK: [[I:%.+]] = alloca i32,
22 // CHECK: store i32 0, ptr [[I]],
23 // CHECK: br label %[[FOR_COND:.+]]
24 // CHECK: [[FOR_COND]]:
25 // CHECK: [[ZERO:%.+]] = load i32, ptr [[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, ptr [[I]],
32 // CHECK: [[INC:%.+]] = add nsw i32 [[ONE]], 1
33 // CHECK: store i32 [[INC]], ptr [[I]],
34 // CHECK: br label %[[FOR_COND]],
35 // CHECK: [[FOR_END]]:
36 // CHECK: ret void
37 // CHECK: }
39 #endif