[PATCH] D55735: [InstSimplify] Simplify saturating add/sub + icmp

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 15 02:57:01 PST 2018


nikic created this revision.
nikic added reviewers: spatel, RKSimon.
Herald added subscribers: llvm-commits, JDevlieghere.

If a saturating add/sub has one constant operand, then we can determine the possible range of outputs it can produce, and simplify an icmp comparison based on that.

I'm implementing this in InstSimplify, with a similar approach to already existing code for binary operators. I previously started out by adding support for this to ConstantRange, which would be able to handle more general cases, but I couldn't figure out which pass would be responsible for the actual simplification.

Ref: https://github.com/rust-lang/rust/issues/44500


Repository:
  rL LLVM

https://reviews.llvm.org/D55735

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55735.178350.patch
Type: text/x-patch
Size: 6032 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181215/1d11f8aa/attachment.bin>


More information about the llvm-commits mailing list