[PATCH] D150102: [KnownBits] Add implementations for saturating add/sub functions

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 03:47:42 PDT 2023


RKSimon added inline comments.


================
Comment at: llvm/include/llvm/Support/KnownBits.h:314
 
+  static KnownBits sadd_sat(const KnownBits &LHS, const KnownBits &RHS);
+  static KnownBits uadd_sat(const KnownBits &LHS, const KnownBits &RHS);
----------------
(style) Description comments


================
Comment at: llvm/lib/Support/KnownBits.cpp:443
+    return K.Zero[BitWidth - 1] || K.One[BitWidth - 1];
+  };
+  std::optional<bool> Overflow;
----------------
This might be worth changing into a KnownBits::isSignBitKnown() helper method?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150102/new/

https://reviews.llvm.org/D150102



More information about the llvm-commits mailing list