[llvm] [KnownBits] Make `avg{Ceil,Floor}S` and `{s,u}{add,sub}_sat` optimal (PR #110329)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 27 22:45:38 PDT 2024


================
@@ -714,8 +720,9 @@ static KnownBits computeForSatAddSub(bool Add, bool Signed,
     APInt C;
     if (Signed) {
       // sadd.sat / ssub.sat
-      assert(SignBitKnown(LHS) &&
-             "We somehow know overflow without knowing input sign");
+      assert(LHS.isNegative() ||
+             LHS.isNonNegative() &&
----------------
dtcxzyw wrote:

```suggestion
      assert(!LHS.isSignUnknown() &&
```

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


More information about the llvm-commits mailing list