[compiler-rt] 93a0ff2 - [profile] Update test to make condition non-redundant.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 5 11:07:54 PST 2023


Author: Florian Hahn
Date: 2023-01-05T19:07:04Z
New Revision: 93a0ff232849b22278945a06ef9c84cf404c1074

URL: https://github.com/llvm/llvm-project/commit/93a0ff232849b22278945a06ef9c84cf404c1074
DIFF: https://github.com/llvm/llvm-project/commit/93a0ff232849b22278945a06ef9c84cf404c1074.diff

LOG: [profile] Update test to make condition non-redundant.

The tests contain a redundant condition in the else if branch that can
be simplified with fb13dcf3431c.

Update the condition used to prevent it from getting removed.

Alive2 proof for check removal:
https://alive2.llvm.org/ce/z/iFBnsy

Added: 
    

Modified: 
    compiler-rt/test/profile/Linux/counter_promo_for.c
    compiler-rt/test/profile/Linux/counter_promo_while.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/profile/Linux/counter_promo_for.c b/compiler-rt/test/profile/Linux/counter_promo_for.c
index ffb107a7027b5..a63b645359593 100644
--- a/compiler-rt/test/profile/Linux/counter_promo_for.c
+++ b/compiler-rt/test/profile/Linux/counter_promo_for.c
@@ -46,7 +46,7 @@ __attribute__((noinline)) void foo(int n, int N) {
   for (i = 0; i < N; i++) {
     if (i < n + 1)
       bar(1);
-    else if (i < n - 1)
+    else if (i == n - 1)
       bar(2);
     else
       bar(3);

diff  --git a/compiler-rt/test/profile/Linux/counter_promo_while.c b/compiler-rt/test/profile/Linux/counter_promo_while.c
index 3fb6561777095..b9ca5a55f9d54 100644
--- a/compiler-rt/test/profile/Linux/counter_promo_while.c
+++ b/compiler-rt/test/profile/Linux/counter_promo_while.c
@@ -41,7 +41,7 @@ __attribute__((noinline)) void foo(int n, int N) {
   while (i < N) {
     if (i < n + 1)
       bar(1);
-    else if (i < n - 1)
+    else if (i == n - 1)
       bar(2);
     else
       bar(3);


        


More information about the llvm-commits mailing list