InstCombine: Don't combine constants on unsigned icmps
authorReid Kleckner <reid@kleckner.net>
Thu, 27 Mar 2014 17:49:27 +0000 (17:49 +0000)
committerReid Kleckner <reid@kleckner.net>
Thu, 27 Mar 2014 17:49:27 +0000 (17:49 +0000)
commit63b11ef6d40b719d555c1398ca05b1f477ecfe39
treec9d1f41f4b3e4bf7db62725d68efb3313a82bb52
parent0c6d96cf160f2a6c63f59b5ab7e7a6bbe903ede3
InstCombine: Don't combine constants on unsigned icmps

Fixes a miscompile introduced in r204912.  It would miscompile code like
(unsigned)(a + -49) <= 5U.  The transform would turn this into
(unsigned)a < 55U, which would return true for values in [0, 49], when
it should not.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204948 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineCompares.cpp
test/Transforms/InstCombine/icmp.ll