[PATCH] D67412: [InstCombine] foldUnsignedUnderflowCheck(): handle last few cases (PR43251)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 10 12:37:16 PDT 2019


lebedev.ri created this revision.
lebedev.ri added reviewers: spatel, nikic, xbolva00.
lebedev.ri added a project: LLVM.
Herald added a subscriber: hiraditya.
lebedev.ri added parent revisions: D67411: [InstSimplify] simplifyUnsignedRangeCheck(): handle more cases (PR43251), D67356: [InstCombine] Simplify @llvm.usub.with.overflow+non-zero check (PR43251).

I don't have a direct motivational case for this,
but it would be good to have this for completeness/symmetry.

This pattern is basically the motivational pattern from
https://bugs.llvm.org/show_bug.cgi?id=43251
but with different predicate that requires that the offset is non-zero.

The completeness bit comes from the fact that a similar pattern (offset != zero)
will be needed for https://bugs.llvm.org/show_bug.cgi?id=43259,
so it'd seem to be good to not overlook very similar patterns..

Also, there is something odd with `isKnownNonZero()`, if the non-zero
knowledge was specified as an assumption, it didn't pick it up (PR43267)

With this, i see no other missing folds for
https://bugs.llvm.org/show_bug.cgi?id=43251


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67412

Files:
  llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  llvm/test/Transforms/InstCombine/result-of-usub-is-non-zero-and-no-overflow.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67412.219586.patch
Type: text/x-patch
Size: 4959 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190910/4fa9103a/attachment.bin>


More information about the llvm-commits mailing list