diff options
Diffstat (limited to 'clang/test/Profile/misexpect-switch-default.c')
| -rw-r--r-- | clang/test/Profile/misexpect-switch-default.c | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/clang/test/Profile/misexpect-switch-default.c b/clang/test/Profile/misexpect-switch-default.c deleted file mode 100644 index 3d1079d79f9..00000000000 --- a/clang/test/Profile/misexpect-switch-default.c +++ /dev/null @@ -1,40 +0,0 @@ -// Test that misexpect detects mis-annotated switch statements for default case - -// RUN: llvm-profdata merge %S/Inputs/misexpect-switch-default.proftext -o %t.profdata -// RUN: %clang_cc1 %s -O2 -o - -emit-llvm -fprofile-instrument-use-path=%t.profdata -verify -Wmisexpect -debug-info-kind=line-tables-only - -int sum(int *buff, int size); -int random_sample(int *buff, int size); -int rand(); -void init_arry(); - -const int inner_loop = 1000; -const int outer_loop = 20; -const int arry_size = 25; - -int arry[arry_size] = {0}; - -int main() { - init_arry(); - int val = 0; - int j; - for (j = 0; j < outer_loop * inner_loop; ++j) { - unsigned condition = rand() % 5; - switch (__builtin_expect(condition, 6)) { // expected-warning-re {{Potential performance regression from use of __builtin_expect(): Annotation was correct on {{.+}}% ({{[0-9]+ / [0-9]+}}) of profiled executions.}} - case 0: - val += sum(arry, arry_size); - break; - case 1: - case 2: - case 3: - break; - case 4: - val += random_sample(arry, arry_size); - break; - default: - __builtin_unreachable(); - } // end switch - } // end outer_loop - - return 0; -} |

