Skip to content

Commit 4b3bc46

Browse files
committed
[Remarks] Update LV analysis remark frontend test to avoid switch.
Support for vectorizing switch statements will be added in #99808. Update the loop to use a call that cannot be vectorized to preserve testing surfacing analysis remarks via the frontend.
1 parent 2ef553c commit 4b3bc46

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed
Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
11
// RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -emit-llvm -Rpass-analysis -S %s -o - 2>&1 | FileCheck %s --check-prefix=RPASS
22
// RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -emit-llvm -S %s -o - 2>&1 | FileCheck %s
33

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
4+
// RPASS: {{.*}}:12:5: remark: loop not vectorized: call instruction cannot be vectorized
5+
// CHECK-NOT: remark: loop not vectorized
66

7-
double foo(int N, int *Array) {
8-
double v = 0.0;
7+
void bar(void);
98

9+
void foo(int N) {
1010
#pragma clang loop vectorize(enable)
1111
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;
17-
}
12+
bar();
1813
}
19-
20-
return v;
2114
}

0 commit comments

Comments
 (0)