[CodeGen] Fix a scalable-vector crash in VSELECT legalization
authorFraser Cormack <fraser@codeplay.com>
Wed, 2 Jun 2021 16:58:29 +0000 (17:58 +0100)
committerFraser Cormack <fraser@codeplay.com>
Thu, 3 Jun 2021 09:24:55 +0000 (10:24 +0100)
commit1de1887f5f18cdd2cffb756afcbfb5274b4fd92f
tree94c37c3d25ef50fd546529aa375f99b642950955
parente149c8e8ccce3c3f2fe23e008afdbd99ab33e558
[CodeGen] Fix a scalable-vector crash in VSELECT legalization

The `DAGTypeLegalizer::WidenVSELECTMask` function is not (yet) ready for
scalable vector types, and has numerous places in which it tries to grab
either the fixed size or number of elements of its types.

I believe that it should be possible to update this method to properly
account for scalable-vector types, but we don't have test cases for
that; RISC-V bails out early on as it has legal i1 vector masks. As
such, this patch just prevents it from crashing.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D103536
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
llvm/test/CodeGen/RISCV/rvv/vselect-fp-rv32.ll
llvm/test/CodeGen/RISCV/rvv/vselect-fp-rv64.ll