OSDN Git Service

[SelectionDAG] When scalarizing vselect, don't assert on
authorElad Cohen <elad2.cohen@intel.com>
Thu, 10 Aug 2017 07:44:23 +0000 (07:44 +0000)
committerElad Cohen <elad2.cohen@intel.com>
Thu, 10 Aug 2017 07:44:23 +0000 (07:44 +0000)
commit00708415fb45c18f9871def78647dd555c253e0b
tree54bd2da407475c2b1807cf341faf22e828f65a26
parenta3b8ce30a4f529175b6f723d6c622eb7e78b03b0
[SelectionDAG] When scalarizing vselect, don't assert on
a legal cond operand.

When scalarizing the result of a vselect, the legalizer currently expects
to already have scalarized the operands. While this is true for the true/false
operands (which have the same type as the result), it is not case for the
condition operand. On X86 AVX512, v1i1 is legal - this leads to operations such
as '< N x type> vselect < N x i1> < N x type> < N x type>' where < N x type > is
illegal to hit an assertion during the scalarization.

The handling is similar to r205625.
This also exposes the fact that (v1i1 extract_subvector) should be legal
and selectable on AVX512 - We do this by custom lowering to vector_extract_elt.
This still leaves us in some cases with redundant dag nodes which will be
combined in a separate soon to come patch.

This fixes pr33349.

Differential revision: https://reviews.llvm.org/D36511

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310552 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/pr33349.ll [new file with mode: 0644]