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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 7 02:37:43 PDT 2024


================
@@ -1011,21 +971,16 @@ KnownBits KnownBits::sdiv(const KnownBits &LHS, const KnownBits &RHS,
   }
 
   Known = divComputeLowBit(Known, LHS, RHS, Exact);
-
-  assert(!Known.hasConflict() && "Bad Output");
   return Known;
 }
 
 KnownBits KnownBits::udiv(const KnownBits &LHS, const KnownBits &RHS,
                           bool Exact) {
   unsigned BitWidth = LHS.getBitWidth();
-  assert(!LHS.hasConflict() && !RHS.hasConflict());
   KnownBits Known(BitWidth);
 
   if (LHS.isZero() || RHS.isZero()) {
-    // Result is either known Zero or UB. Return Zero either way.
-    // Checking this earlier saves us a lot of special cases later on.
-    Known.setAllZero();
+    // Result is either known Zero or UB.
----------------
nikic wrote:

This setAllZero() call should be retained. Otherwise we would now provide a worse result if the LHS is zero. (It would go from result zero to result unknown).

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


More information about the llvm-commits mailing list