Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Frontend / optimization-remark-analysis.c
blobe43984942a6efbf958e8e49cc484f63f10f90035
1 // RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -emit-llvm -Rpass-analysis -S %s -o - 2>&1 | FileCheck %s --check-prefix=RPASS
2 // RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -emit-llvm -S %s -o - 2>&1 | FileCheck %s
4 // RPASS: {{.*}}:12:5: remark: loop not vectorized: loop contains a switch statement
5 // CHECK-NOT: remark: loop not vectorized: loop contains a switch statement
7 double foo(int N, int *Array) {
8 double v = 0.0;
10 #pragma clang loop vectorize(enable)
11 for (int i = 0; i < N; i++) {
12 switch(Array[i]) {
13 case 0: v += 1.0f; break;
14 case 1: v -= 0.5f; break;
15 case 2: v *= 2.0f; break;
16 default: v = 0.0f;
20 return v;