]> granicus.if.org Git - llvm/commit
[InstCombine] Fold (A - B) u>=/u< A --> B u>/u<= A iff B != 0
authorRoman Lebedev <lebedev.ri@gmail.com>
Wed, 25 Sep 2019 19:06:40 +0000 (19:06 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Wed, 25 Sep 2019 19:06:40 +0000 (19:06 +0000)
commit864d2f9cf82ccc06deebd8458c019aa65b2b4012
tree26c9bfe73554a53284a34a94e8fc3bc46c008751
parent0b1a028fea38bdb7ac288215000ab3720c267404
[InstCombine] Fold  (A - B) u>=/u< A  --> B  u>/u<= A  iff B != 0

https://rise4fun.com/Alive/KtL

This also shows that the fold added in D67412 / r372257
was too specific, and the new fold allows those test cases
to be handled more generically, therefore i delete now-dead code.

This is yet again motivated by
D67122 "[UBSan][clang][compiler-rt] Applying non-zero offset to nullptr is undefined behaviour"

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372912 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
lib/Transforms/InstCombine/InstCombineCompares.cpp
lib/Transforms/InstCombine/InstCombineInternal.h
test/Transforms/InstCombine/result-of-usub-is-non-zero-and-no-overflow.ll
test/Transforms/InstCombine/strict-sub-underflow-check-to-comparison-of-sub-operands.ll