llvm/clang/test/Frontend/optimization-remark-analysis.c
Arthur Eubanks e1ed02181f [clang] Make -Rpass imply -Rpass=.*
Previously with -Rpass (and friends) we'd have remarks "enabled", but
without an actual regex.

As seen in the test change to line numbers, this can give us better
diagnostics by properly enabling NeedLocTracking with -Rpass.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D110201
2021-09-21 14:35:56 -07:00

22 lines
691 B
C

// RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -emit-llvm -Rpass-analysis -S %s -o - 2>&1 | FileCheck %s --check-prefix=RPASS
// RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -emit-llvm -S %s -o - 2>&1 | FileCheck %s
// RPASS: {{.*}}:12:5: remark: loop not vectorized: loop contains a switch statement
// CHECK-NOT: remark: loop not vectorized: loop contains a switch statement
double foo(int N, int *Array) {
double v = 0.0;
#pragma clang loop vectorize(enable)
for (int i = 0; i < N; i++) {
switch(Array[i]) {
case 0: v += 1.0f; break;
case 1: v -= 0.5f; break;
case 2: v *= 2.0f; break;
default: v = 0.0f;
}
}
return v;
}