[PATCH] D62466: [IR] Add SaturatingInst and BinaryOpIntrinsic

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 26 09:41:47 PDT 2019


nikic created this revision.
nikic added reviewers: lebedev.ri, spatel.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

Based on the suggestion in https://reviews.llvm.org/D62447?id=201397#inline-554867, this adds a `SaturatingInst` class that represents the saturating add/sub family of intrinsics. It exposes the same interface as `WithOverflowInst`, for this reason I have also added a common base class `BinaryOpIntrinsic` that holds the actual implementation code.

Planned use-sites:

- https://github.com/llvm-mirror/llvm/blob/master/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp#L401-L441 Both SaturingInst and the common base class will come in handy to extend this with.overflow code to saturating math.
- https://github.com/llvm-mirror/llvm/blob/master/lib/Transforms/InstCombine/InstCombineCalls.cpp#L2058-L2087 can be simplified in conjunction with D62463 <https://reviews.llvm.org/D62463>.


Repository:
  rL LLVM

https://reviews.llvm.org/D62466

Files:
  llvm/include/llvm/IR/IntrinsicInst.h
  llvm/lib/IR/IntrinsicInst.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62466.201457.patch
Type: text/x-patch
Size: 3802 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190526/2496047d/attachment.bin>


More information about the llvm-commits mailing list