diff options
Diffstat (limited to 'clang/test')
13 files changed, 0 insertions, 323 deletions
diff --git a/clang/test/Profile/Inputs/misexpect-branch-nonconst-expect-arg.proftext b/clang/test/Profile/Inputs/misexpect-branch-nonconst-expect-arg.proftext deleted file mode 100644 index a99351c06e5..00000000000 --- a/clang/test/Profile/Inputs/misexpect-branch-nonconst-expect-arg.proftext +++ /dev/null @@ -1,9 +0,0 @@ -bar -# Func Hash: -11262309464 -# Num Counters: -2 -# Counter Values: -200000 -2 - diff --git a/clang/test/Profile/Inputs/misexpect-branch.proftext b/clang/test/Profile/Inputs/misexpect-branch.proftext deleted file mode 100644 index b809c1491fb..00000000000 --- a/clang/test/Profile/Inputs/misexpect-branch.proftext +++ /dev/null @@ -1,9 +0,0 @@ -bar -# Func Hash: -45795613684824 -# Num Counters: -2 -# Counter Values: -200000 -0 - diff --git a/clang/test/Profile/Inputs/misexpect-switch-default-only.proftext b/clang/test/Profile/Inputs/misexpect-switch-default-only.proftext deleted file mode 100644 index ac59378e768..00000000000 --- a/clang/test/Profile/Inputs/misexpect-switch-default-only.proftext +++ /dev/null @@ -1,12 +0,0 @@ -main -# Func Hash: -79676873694057560 -# Num Counters: -5 -# Counter Values: -1 -20 -20000 -20000 -20000 - diff --git a/clang/test/Profile/Inputs/misexpect-switch-default.proftext b/clang/test/Profile/Inputs/misexpect-switch-default.proftext deleted file mode 100644 index 7b2d59781a1..00000000000 --- a/clang/test/Profile/Inputs/misexpect-switch-default.proftext +++ /dev/null @@ -1,16 +0,0 @@ -main -# Func Hash: -8712453512413296413 -# Num Counters: -9 -# Counter Values: -1 -20000 -20000 -4066 -11889 -0 -0 -4045 -0 - diff --git a/clang/test/Profile/Inputs/misexpect-switch.proftext b/clang/test/Profile/Inputs/misexpect-switch.proftext deleted file mode 100644 index ce4c96b3e3a..00000000000 --- a/clang/test/Profile/Inputs/misexpect-switch.proftext +++ /dev/null @@ -1,16 +0,0 @@ -main -# Func Hash: -1965403898329309329 -# Num Counters: -9 -# Counter Values: -1 -20 -20000 -20000 -12 -26 -0 -0 -19962 - diff --git a/clang/test/Profile/misexpect-branch-cold.c b/clang/test/Profile/misexpect-branch-cold.c deleted file mode 100644 index 6d34f92a254..00000000000 --- a/clang/test/Profile/misexpect-branch-cold.c +++ /dev/null @@ -1,26 +0,0 @@ -// Test that misexpect emits no warning when prediction is correct - -// RUN: llvm-profdata merge %S/Inputs/misexpect-branch.proftext -o %t.profdata -// RUN: %clang_cc1 %s -O2 -o - -disable-llvm-passes -emit-llvm -fprofile-instrument-use-path=%t.profdata -verify -Wmisexpect - -// expected-no-diagnostics -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) - -int foo(int); -int baz(int); -int buzz(); - -const int inner_loop = 100; -const int outer_loop = 2000; - -int bar() { - int rando = buzz(); - int x = 0; - if (unlikely(rando % (outer_loop * inner_loop) == 0)) { - x = baz(rando); - } else { - x = foo(50); - } - return x; -} diff --git a/clang/test/Profile/misexpect-branch-nonconst-expected-val.c b/clang/test/Profile/misexpect-branch-nonconst-expected-val.c deleted file mode 100644 index c5167b9a2a0..00000000000 --- a/clang/test/Profile/misexpect-branch-nonconst-expected-val.c +++ /dev/null @@ -1,23 +0,0 @@ -// Test that misexpect emits no warning when condition is not a compile-time constant - -// RUN: llvm-profdata merge %S/Inputs/misexpect-branch-nonconst-expect-arg.proftext -o %t.profdata -// RUN: %clang_cc1 %s -O2 -o - -disable-llvm-passes -emit-llvm -fprofile-instrument-use-path=%t.profdata -verify -Wmisexpect - -// expected-no-diagnostics -int foo(int); -int baz(int); -int buzz(); - -const int inner_loop = 100; -const int outer_loop = 2000; - -int bar() { - int rando = buzz(); - int x = 0; - if (__builtin_expect(rando % (outer_loop * inner_loop) == 0, buzz())) { - x = baz(rando); - } else { - x = foo(50); - } - return x; -} diff --git a/clang/test/Profile/misexpect-branch-unpredictable.c b/clang/test/Profile/misexpect-branch-unpredictable.c deleted file mode 100644 index 6c4f90146a2..00000000000 --- a/clang/test/Profile/misexpect-branch-unpredictable.c +++ /dev/null @@ -1,25 +0,0 @@ -// Test that misexpect emits no warning when prediction is correct - -// RUN: llvm-profdata merge %S/Inputs/misexpect-branch.proftext -o %t.profdata -// RUN: %clang_cc1 %s -O2 -o - -disable-llvm-passes -emit-llvm -fprofile-instrument-use-path=%t.profdata -verify -Wmisexpect - -// expected-no-diagnostics -#define unpredictable(x) __builtin_unpredictable(!!(x)) - -int foo(int); -int baz(int); -int buzz(); - -const int inner_loop = 100; -const int outer_loop = 2000; - -int bar() { - int rando = buzz(); - int x = 0; - if (unpredictable(rando % (outer_loop * inner_loop) == 0)) { - x = baz(rando); - } else { - x = foo(50); - } - return x; -} diff --git a/clang/test/Profile/misexpect-branch.c b/clang/test/Profile/misexpect-branch.c deleted file mode 100644 index 503aa7398e9..00000000000 --- a/clang/test/Profile/misexpect-branch.c +++ /dev/null @@ -1,28 +0,0 @@ -// Test that misexpect detects mis-annotated branches - -// RUN: llvm-profdata merge %S/Inputs/misexpect-branch.proftext -o %t.profdata -// RUN: %clang_cc1 %s -O2 -o - -emit-llvm -fprofile-instrument-use-path=%t.profdata -verify=imprecise -Wmisexpect -// RUN: %clang_cc1 %s -O2 -o - -emit-llvm -fprofile-instrument-use-path=%t.profdata -verify=exact -Wmisexpect -debug-info-kind=line-tables-only -// RUN: %clang_cc1 %s -O2 -o - -disable-llvm-passes -emit-llvm -fprofile-instrument-use-path=%t.profdata -verify=foo - -// foo-no-diagnostics -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) - -int foo(int); -int baz(int); -int buzz(); - -const int inner_loop = 100; -const int outer_loop = 2000; - -int bar() { // imprecise-warning-re {{Potential performance regression from use of __builtin_expect(): Annotation was correct on {{.+}}% ({{[0-9]+ / [0-9]+}}) of profiled executions.}} - int rando = buzz(); - int x = 0; - if (likely(rando % (outer_loop * inner_loop) == 0)) { // exact-warning-re {{Potential performance regression from use of __builtin_expect(): Annotation was correct on {{.+}}% ({{[0-9]+ / [0-9]+}}) of profiled executions.}} - x = baz(rando); - } else { - x = foo(50); - } - return x; -} 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; -} diff --git a/clang/test/Profile/misexpect-switch-nonconst.c b/clang/test/Profile/misexpect-switch-nonconst.c deleted file mode 100644 index bf2143b6f43..00000000000 --- a/clang/test/Profile/misexpect-switch-nonconst.c +++ /dev/null @@ -1,43 +0,0 @@ -// Test that misexpect emits no warning when switch condition is non-const - -// RUN: llvm-profdata merge %S/Inputs/misexpect-switch.proftext -o %t.profdata -// RUN: %clang_cc1 %s -O2 -o - -disable-llvm-passes -emit-llvm -fprofile-instrument-use-path=%t.profdata -verify -Wmisexpect - -// expected-no-diagnostics -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, k; - for (j = 0; j < outer_loop; ++j) { - for (k = 0; k < inner_loop; ++k) { - unsigned condition = rand() % 10000; - switch (__builtin_expect(condition, rand())) { - case 0: - val += sum(arry, arry_size); - break; - case 1: - case 2: - case 3: - case 4: - val += random_sample(arry, arry_size); - break; - default: - __builtin_unreachable(); - } // end switch - } // end inner_loop - } // end outer_loop - - return 0; -} diff --git a/clang/test/Profile/misexpect-switch-only-default-case.c b/clang/test/Profile/misexpect-switch-only-default-case.c deleted file mode 100644 index 3886472e2b4..00000000000 --- a/clang/test/Profile/misexpect-switch-only-default-case.c +++ /dev/null @@ -1,35 +0,0 @@ -// Test that misexpect emits no warning when there is only one switch case - -// RUN: llvm-profdata merge %S/Inputs/misexpect-switch-default-only.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 - -// expected-no-diagnostics -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, k; - for (j = 0; j < outer_loop; ++j) { - for (k = 0; k < inner_loop; ++k) { - unsigned condition = rand() % 10000; - switch (__builtin_expect(condition, 0)) { - default: - val += random_sample(arry, arry_size); - break; - }; // end switch - } // end inner_loop - } // end outer_loop - - return 0; -} diff --git a/clang/test/Profile/misexpect-switch.c b/clang/test/Profile/misexpect-switch.c deleted file mode 100644 index a7f01bcc998..00000000000 --- a/clang/test/Profile/misexpect-switch.c +++ /dev/null @@ -1,41 +0,0 @@ -// Test that misexpect detects mis-annotated switch statements - -// RUN: llvm-profdata merge %S/Inputs/misexpect-switch.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, k; - for (j = 0; j < outer_loop; ++j) { - for (k = 0; k < inner_loop; ++k) { - unsigned condition = rand() % 10000; - switch (__builtin_expect(condition, 0)) { // 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; - default: - val += random_sample(arry, arry_size); - break; - } // end switch - } // end inner_loop - } // end outer_loop - - return 0; -} |

