[PATCH] D54532: [InstructionSimplify] Add support for saturating add/sub

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 14 08:46:48 PST 2018


nikic created this revision.
Herald added a subscriber: llvm-commits.

Add support for saturating add/sub in InstructionSimplify. In particular, the following simplifications are supported:

- sat(X + 0) -> X
- sat(X + undef) -> X
- sat(X uadd MAX) -> MAX
- (and commutative variants)

- sat(X - 0) -> X
- sat(X - X) -> 0
- sat(X - undef) -> 0
- sat(undef - X) -> 0
- sat(0 usub X) -> 0
- sat(X usub MAX) -> 0


Repository:
  rL LLVM

https://reviews.llvm.org/D54532

Files:
  lib/Analysis/InstructionSimplify.cpp
  test/Transforms/InstSimplify/saturating-add-sub.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54532.174047.patch
Type: text/x-patch
Size: 9486 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181114/dd04e977/attachment.bin>


More information about the llvm-commits mailing list