[InstCombine] (-NSW x) s< x --> x s> 0 (PR39480)
authorRoman Lebedev <lebedev.ri@gmail.com>
Thu, 6 Aug 2020 08:10:38 +0000 (11:10 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Thu, 6 Aug 2020 08:50:35 +0000 (11:50 +0300)
commit01a6c4bd26a599e877301568f77eb835d0a6e812
tree9c492446bdf3797330532f2551042c9198b9350e
parent388520765157f1ce7e48e49179dc58781ae61f56
[InstCombine] (-NSW x) s< x  --> x s> 0  (PR39480)

Name: (-x) s< x  -->  x > 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp slt i8 %neg_x, %x
  =>
%r = icmp sgt i8 %x, 0

https://rise4fun.com/Alive/3IXb

https://bugs.llvm.org/show_bug.cgi?id=39480
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/test/Transforms/InstCombine/cmp-x-vs-neg-x.ll