[InstCombine] (-NSW x) u>= x --> x s>= 0 (PR39480)
authorRoman Lebedev <lebedev.ri@gmail.com>
Thu, 6 Aug 2020 08:23:59 +0000 (11:23 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Thu, 6 Aug 2020 08:50:35 +0000 (11:50 +0300)
commit0e1241a3c9881d5cb3280bdb0c36712fae957694
tree1f54772ab44aa3bd62b6887d6ca7adbe70716ce0
parent16c642fa39d50dd066e364e0f258140a3dbaa64b
[InstCombine] (-NSW x) u>= x  --> x s>= 0  (PR39480)

Name: (-x) u>= x  -->  x s>= 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp uge i8 %neg_x, %x
  =>
%r = icmp sge i8 %x, 0

https://rise4fun.com/Alive/LLHd

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