[PATCH] D62447: [LVI][CVP] Add support for saturating add/sub

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 25 09:34:25 PDT 2019


nikic marked an inline comment as done.
nikic added inline comments.


================
Comment at: llvm/lib/Analysis/LazyValueInfo.cpp:1122
+    ValueLatticeElement &BBLV, IntrinsicInst *II, BasicBlock *BB) {
+  switch (II->getIntrinsicID()) {
+  case Intrinsic::uadd_sat:
----------------
lebedev.ri wrote:
> Have you considered adding a `SaturatingInst` base class, much like `WithOverflowInst`;
> and/or `saturatingBinaryOp`, much like `binaryOp`, to `ConstantRange`?
> I think that might potentially be a bit cleaner overall.
> (Not for this patch)
Yeah, that might make sense. Having it (possibly even a common base class with WithOverflowInst) would be useful to extend https://github.com/llvm-mirror/llvm/blob/master/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp#L402 to saturating math.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D62447





More information about the llvm-commits mailing list