]> granicus.if.org Git - llvm/commit
Merging r348462:
authorTom Stellard <tstellar@redhat.com>
Thu, 6 Dec 2018 22:36:26 +0000 (22:36 +0000)
committerTom Stellard <tstellar@redhat.com>
Thu, 6 Dec 2018 22:36:26 +0000 (22:36 +0000)
commitcc39aee52886ad79b637af4311b1f3fe5e34953e
tree5f39e64e0d302bb2efceaf917f7132a91cea7f3e
parentfa099fd85c19d67353a4167fe57e98853e572fae
Merging r348462:

------------------------------------------------------------------------
r348462 | lebedevri | 2018-12-06 00:14:24 -0800 (Thu, 06 Dec 2018) | 13 lines

[InstCombine] foldICmpWithLowBitMaskedVal(): don't miscompile -1 vector elts

I was finally able to quantify what i thought was missing in the fix,
it was vector constants. If we have a scalar (and %x, -1),
it will be instsimplified before we reach this code,
but if it is a vector, we may still have a -1 element.

Thus, we want to avoid the fold if *at least one* element is -1.
Or in other words, ignoring the undef elements, no sign bits
should be set. Thus, m_NonNegative().

A follow-up for rL348181
https://bugs.llvm.org/show_bug.cgi?id=39861
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_70@348538 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineCompares.cpp
test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-sge-to-icmp-sle.ll
test/Transforms/InstCombine/canonicalize-constant-low-bit-mask-and-icmp-slt-to-icmp-sgt.ll