[X86] Lower VSELECT into SHRUNKBLEND when we shrink the bits used into the
authorQuentin Colombet <qcolombet@apple.com>
Thu, 6 Nov 2014 02:25:03 +0000 (02:25 +0000)
committerQuentin Colombet <qcolombet@apple.com>
Thu, 6 Nov 2014 02:25:03 +0000 (02:25 +0000)
commitdbe33e7aa41a0dfcdd826d2e4709f64975648729
tree87ca36118ffc3e9076d9a1617097c310ab8be723
parent2dfef4bfd6673e9f25b6b06a880797880b8b3b6c
[X86] Lower VSELECT into SHRUNKBLEND when we shrink the bits used into the
condition to match a blend.
This prevents optimizations that work on VSELECT to perform invalid
transformations. Indeed, the optimized condition does not match the vector
boolean content that is expected and bad things may happen.

This patch yields the exact same code on the whole test-suite + specs (-O3 and
-O3 -march=core-avx2), it improves one test case (vector-blend.ll) and fixes a
bug reduced in vselect-avx.ll.

<rdar://problem/18819506>

llvm-svn: 221429
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86ISelLowering.h
llvm/test/CodeGen/X86/vector-blend.ll
llvm/test/CodeGen/X86/vselect-avx.ll