[InstCombine] foldICmpWithLowBitMaskedVal(): 'icmp sgt/sle': avoid miscompiles
authorRoman Lebedev <lebedev.ri@gmail.com>
Sun, 9 Jun 2019 16:30:42 +0000 (16:30 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Sun, 9 Jun 2019 16:30:42 +0000 (16:30 +0000)
commitd669758d84217f7e057740053783e012369337d0
tree8bcb60a4779edb10702d06d75d5475a736915fdb
parentff0c99b0177ddb091aea24576559dad6d00630ba
[InstCombine] foldICmpWithLowBitMaskedVal(): 'icmp sgt/sle': avoid miscompiles

A precondition 'x != 0' was forgotten by me:
https://rise4fun.com/Alive/JFNP
https://rise4fun.com/Alive/jHvL

These 4 folds with non-constants could be re-enabled,
but for now let's go for the simplest solution.

https://bugs.llvm.org/show_bug.cgi?id=42198

llvm-svn: 362911
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sgt-to-icmp-sgt.ll
llvm/test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sle-to-icmp-sle.ll