[llvm] bbdca53 - [KnownBitsTest] Add optimality tests to some optimal impls; NFC

Noah Goldstein via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 30 11:13:37 PDT 2024


Author: Noah Goldstein
Date: 2024-09-30T13:10:16-05:00
New Revision: bbdca53bad670b69e299b1094e2d654a3a76e0dd

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

LOG: [KnownBitsTest] Add optimality tests to some optimal impls; NFC

Adding optimality test to `add`, `sub`, `avgCeilU` and `avgFloorU`

Added: 
    

Modified: 
    llvm/unittests/Support/KnownBitsTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/Support/KnownBitsTest.cpp b/llvm/unittests/Support/KnownBitsTest.cpp
index b6e16f809ea779..b701757aed5eb9 100644
--- a/llvm/unittests/Support/KnownBitsTest.cpp
+++ b/llvm/unittests/Support/KnownBitsTest.cpp
@@ -305,15 +305,13 @@ TEST(KnownBitsTest, BinaryExhaustive) {
       [](const KnownBits &Known1, const KnownBits &Known2) {
         return KnownBits::add(Known1, Known2);
       },
-      [](const APInt &N1, const APInt &N2) { return N1 + N2; },
-      /*CheckOptimality=*/false);
+      [](const APInt &N1, const APInt &N2) { return N1 + N2; });
   testBinaryOpExhaustive(
       "sub",
       [](const KnownBits &Known1, const KnownBits &Known2) {
         return KnownBits::sub(Known1, Known2);
       },
-      [](const APInt &N1, const APInt &N2) { return N1 - N2; },
-      /*CheckOptimality=*/false);
+      [](const APInt &N1, const APInt &N2) { return N1 - N2; });
   testBinaryOpExhaustive("umax", KnownBits::umax, APIntOps::umax);
   testBinaryOpExhaustive("umin", KnownBits::umin, APIntOps::umin);
   testBinaryOpExhaustive("smax", KnownBits::smax, APIntOps::smax);
@@ -524,16 +522,15 @@ TEST(KnownBitsTest, BinaryExhaustive) {
       /*CheckOptimality=*/false);
 
   testBinaryOpExhaustive("avgFloorS", KnownBits::avgFloorS, APIntOps::avgFloorS,
-                         false);
+                         /*CheckOptimality=*/false);
 
-  testBinaryOpExhaustive("avgFloorU", KnownBits::avgFloorU, APIntOps::avgFloorU,
-                         false);
+  testBinaryOpExhaustive("avgFloorU", KnownBits::avgFloorU,
+                         APIntOps::avgFloorU);
 
-  testBinaryOpExhaustive("avgCeilU", KnownBits::avgCeilU, APIntOps::avgCeilU,
-                         false);
+  testBinaryOpExhaustive("avgCeilU", KnownBits::avgCeilU, APIntOps::avgCeilU);
 
   testBinaryOpExhaustive("avgCeilS", KnownBits::avgCeilS, APIntOps::avgCeilS,
-                         false);
+                         /*CheckOptimality=*/false);
 }
 
 TEST(KnownBitsTest, UnaryExhaustive) {


        


More information about the llvm-commits mailing list