[PATCH] D54534: [InstCombine] Add support for saturating add/sub

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 27 14:45:34 PST 2018


spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.

I think everything's correct here, so LGTM. But this is really several independent changes in 1 patch. Please split this up when committing, so we can reduce the risk of bugs. 
It could be split like this or some other sequence if you see a better way:

1. Canonicalize constants to Op1
2. NeverOverflows / AlwaysOverflows
3. ssub.sat(X, C) -> sadd.sat(X, -C)
4. sat(sat(X + Val2) + Val) -> sat(X + (Val+Val2))
5. sat(sat(X - Val2) - Val) -> sat(X - (Val+Val2))


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

https://reviews.llvm.org/D54534





More information about the llvm-commits mailing list