]> granicus.if.org Git - llvm/commit
[InstCombine] extend vector select matching for non-splat constants
authorSanjay Patel <spatel@rotateright.com>
Wed, 13 Jul 2016 18:07:02 +0000 (18:07 +0000)
committerSanjay Patel <spatel@rotateright.com>
Wed, 13 Jul 2016 18:07:02 +0000 (18:07 +0000)
commitc45e9127fc87ff7fba8e3a2f48c96c67bb163300
treef1915ea73252168b89f2f50f16196d0d58ddf1de
parent6b62d37e9baa319e0975059abde9a2783e827963
[InstCombine] extend vector select matching for non-splat constants

In D21740, we discussed trying to make this a more general matcher. However, I didn't see a clean
way to handle the regular m_Not cases and these non-splat vector patterns, so I've opted for the
direct approach here. If there are other potential uses of areInverseVectorBitmasks(), we could
move that helper function to a higher level.

There is an open question as to which is of these forms should be considered the canonical IR:
  %sel = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i32> %a, <4 x i32> %b
  %shuf = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 5, i32 6, i32 3>

Differential Revision: http://reviews.llvm.org/D22114

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275289 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
test/Transforms/InstCombine/logical-select.ll