]> granicus.if.org Git - llvm/commit
[InstSimplify] simplifyUnsignedRangeCheck(): handle more cases (PR43251)
authorRoman Lebedev <lebedev.ri@gmail.com>
Thu, 12 Sep 2019 09:26:17 +0000 (09:26 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Thu, 12 Sep 2019 09:26:17 +0000 (09:26 +0000)
commitd6c677fa07aed9d5727350bb2414e398584b465f
tree0e8c57c41bfd5a22b3b57df1767f552027be490c
parent7477c288b1f20ac468c97a0e46e47aa1be6b81c8
[InstSimplify] simplifyUnsignedRangeCheck(): handle more cases (PR43251)

Summary:
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..

Proofs: https://rise4fun.com/Alive/21b

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

Reviewers: spatel, nikic, xbolva00

Reviewed By: spatel

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D67411

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371718 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/InstructionSimplify.cpp
test/Transforms/InstSimplify/result-of-usub-by-nonzero-is-non-zero-and-no-overflow.ll