[llvm] [KnownBits] Remove `hasConflict()` assertions (PR #94568)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 04:27:46 PDT 2024


jayfoad wrote:

I expect you would have to make some changes like this, since even the supposedly optimal KnownBits implementations do not always report conflict when they should:
```diff
diff --git a/llvm/unittests/Support/KnownBitsTest.cpp b/llvm/unittests/Support/KnownBitsTest.cpp
index 824cf7501fd4..acec5dbfb4e6 100644
--- a/llvm/unittests/Support/KnownBitsTest.cpp
+++ b/llvm/unittests/Support/KnownBitsTest.cpp
@@ -95,9 +95,10 @@ static void testBinaryOpExhaustive(StringRef Name, BinaryBitsFn BitsFn,
           });
         });
 
-        EXPECT_TRUE(!Computed.hasConflict());
-        EXPECT_TRUE(checkResult(Name, Exact, Computed, {Known1, Known2},
-                                CheckOptimality));
+        if (!Exact.hasConflict()) {
+          EXPECT_TRUE(checkResult(Name, Exact, Computed, {Known1, Known2},
+                                  CheckOptimality));
+        }
         // In some cases we choose to return zero if the result is always
         // poison.
         if (RefinePoisonToZero && Exact.hasConflict()) {
```

https://github.com/llvm/llvm-project/pull/94568


More information about the llvm-commits mailing list