<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/64627>64627</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [X86][SelectionDAG] DAGCombine crash on select + reduce of 5 element vector
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          jacobly0
      </td>
    </tr>
</table>

<pre>
    ```
target triple = "x86_64"

define float @f() "target-features"="-avx512f" { ; no crash when enabled
  %1 = bitcast i5 0 to <5 x i1>
  %2 = select <5 x i1> %1, <5 x float> zeroinitializer, <5 x float> <float 1.0, float 1.0, float 1.0, float 1.0, float 1.0>
  %3 = call float @llvm.vector.reduce.fadd.v5f32(float -0.0, <5 x float> %2)
  ret float %3
}

declare float @llvm.vector.reduce.fadd.v5f32(float, <5 x float>)
```
```
$ llc --version
LLVM (http://llvm.org/):
  LLVM version 16.0.6
  DEBUG build with assertions.
  Default target: x86_64-unknown-linux-gnu
 Host CPU: znver4
$ llc repro.ll
llc: llvm/include/llvm/Support/MachineValueType.h:497: MVT llvm::MVT::changeVectorElementType(MVT) const: Assertion `VecTy.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE && "Simple vector VT not representable by simple integer vector VT!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /home/jacob/.local/lib/dbg/llvm/16.0.6/bin/llc repro.ll
1.      Running pass 'Function Pass Manager' on module 'repro.ll'.
2.      Running pass 'X86 DAG->DAG Instruction Selection' on function '@f'
#10 0x00007f458a48a374 llvm::MVT::changeVectorElementType(llvm::MVT) const llvm/include/llvm/Support/MachineValueType.h:498:7
#11 0x00007f458a48caee llvm::EVT::changeVectorElementType(llvm::EVT) const llvm/include/llvm/CodeGen/ValueTypes.h:105:30
#12 0x00007f458a43840f combineToExtendBoolVectorInReg(unsigned int, llvm::SDLoc const&, llvm::EVT, llvm::SDValue, llvm::SelectionDAG&, llvm::TargetLowering::DAGCombinerInfo&, llvm::X86Subtarget const&) llvm/lib/Target/X86/X86ISelLowering.cpp:45343:17
#13 0x00007f458a359523 combineSelect(llvm::SDNode*, llvm::SelectionDAG&, llvm::TargetLowering::DAGCombinerInfo&, llvm::X86Subtarget const&) llvm/lib/Target/X86/X86ISelLowering.cpp:46110:27
#14 0x00007f458a34f200 llvm::X86TargetLowering::PerformDAGCombine(llvm::SDNode*, llvm::TargetLowering::DAGCombinerInfo&) const llvm/lib/Target/X86/X86ISelLowering.cpp:56417:36
#15 0x00007f4586a3526a (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1852:16
#16 0x00007f4586a3467c (anonymous namespace)::DAGCombiner::Run(llvm::CombineLevel) llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1635:18
#17 0x00007f4586a33ecb llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::AAResults*, llvm::CodeGenOpt::Level) llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:26460:36
#18 0x00007f4586e8fb8b llvm::SelectionDAGISel::CodeGenAndEmitDAG() llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:784:3
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUl1tvo7oTwD-N82IFgc31IQ-0JP1XSvdfNdloz1NlYCDedezImF720x8ZyIW0u2p3n45UhWLGM7-5mYE1Da8lwAwFVyjIJqw1W6Vn31mhcvHqTnJVvs5Q6A5_bobc1DBdg8FG870AjGiGESEvcfgY-oiQXqb_LaHiEnAlFDMY-W6FSIxIYuV7JdMKmGk1NHYjzRAhU_b0EnikQoRgFF1hRK-wVLjQrNni5y1IDJLlAsreAsaIBF4HkXNTsMZgHmAXG4URvQ7wC-YeovMzYdIJNyCgMCOZThMi14fFjtqu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