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

    <tr>
        <th>Summary</th>
        <td>
            [X86][SelectionDAG] assertion calling `uadd.with.overflow.v4i1` with avx512f feature
        </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>
    ```llvm
target triple = "x86_64"

define { <4 x i1>, <4 x i1> } @entry(<4 x i1> %a) "target-features"="+avx512f" { ; no assertion when disabled
  %f = call { <4 x i1>, <4 x i1> } @llvm.uadd.with.overflow.v4i1(<4 x i1> %a, <4 x i1> %a)
  ret { <4 x i1>, <4 x i1> } %f
}

declare { <4 x i1>, <4 x i1> } @llvm.uadd.with.overflow.v4i1(<4 x i1>, <4 x i1>)
```
```
$ llc -version # 37b79e779f447f1c714af7f907e7a2ec846d1da0
LLVM (http://llvm.org/):
  LLVM version 17.0.3
  DEBUG build with assertions.
  Default target: x86_64-unknown-linux-gnu
  Host CPU: znver4
$ llc repro.ll -O0
llc: llvm/lib/Target/X86/X86ISelLowering.cpp:25857: SDValue LowerVSETCC(SDValue, const X86Subtarget &, SelectionDAG &): Assertion `(VTOp0.getScalarSizeInBits() >= 32 || Subtarget.hasBWI()) && "Unexpected operand\
 type"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llc repro.ll -O0
1.      Running pass 'Function Pass Manager' on module 'repro.ll'.
2.      Running pass 'X86 DAG->DAG Instruction Selection' on function '@entry'
 #0 0x00007f29f0b38b36 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) llvm/lib/Support/Unix/Signals.inc:602:11
 #1 0x00007f29f0b3908b PrintStackTraceSignalHandler(void*) llvm/lib/Support/Unix/Signals.inc:675:1
 #2 0x00007f29f0b37233 llvm::sys::RunSignalHandlers() llvm/lib/Support/Signals.cpp:104:5
 #3 0x00007f29f0b39771 SignalHandler(int) llvm/lib/Support/Unix/Signals.inc:413:1
 #4 0x00007f29f0387c90 (/usr/lib64/libc.so.6+0x39c90)
 #5 0x00007f29f03d81ec (/usr/lib64/libc.so.6+0x8a1ec)
 #6 0x00007f29f0387be2 gsignal (/usr/lib64/libc.so.6+0x39be2)
 #7 0x00007f29f03704ed abort (/usr/lib64/libc.so.6+0x224ed)
 #8 0x00007f29f0370415 (/usr/lib64/libc.so.6+0x22415)
 #9 0x00007f29f0380542 (/usr/lib64/libc.so.6+0x32542)
#10 0x00007f29f83de18b LowerVSETCC(llvm::SDValue, llvm::X86Subtarget const&, llvm::SelectionDAG&) llvm/lib/Target/X86/X86ISelLowering.cpp:25858:34
#11 0x00007f29f83db413 llvm::X86TargetLowering::LowerSETCC(llvm::SDValue, llvm::SelectionDAG&) const llvm/lib/Target/X86/X86ISelLowering.cpp:26260:29
#12 0x00007f29f84046f2 llvm::X86TargetLowering::LowerOperation(llvm::SDValue, llvm::SelectionDAG&) const llvm/lib/Target/X86/X86ISelLowering.cpp:34565:40
#13 0x00007f29f509949a (anonymous namespace)::VectorLegalizer::LowerOperationWrapper(llvm::SDNode*, llvm::SmallVectorImpl<llvm::SDValue>&) llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp:527:21
#14 0x00007f29f5098671 (anonymous namespace)::VectorLegalizer::LegalizeOp(llvm::SDValue) llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp:506:9
#15 0x00007f29f509ab8b (anonymous namespace)::VectorLegalizer::RecursivelyLegalizeResults(llvm::SDValue, llvm::MutableArrayRef<llvm::SDValue>) llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp:237:18
#16 0x00007f29f509880c (anonymous namespace)::VectorLegalizer::LegalizeOp(llvm::SDValue) llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp:520:10
#17 0x00007f29f50938ea (anonymous namespace)::VectorLegalizer::Run() llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp:206:5
#18 0x00007f29f5093685 llvm::SelectionDAG::LegalizeVectors() llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp:1770:33
#19 0x00007f29f529e6bf llvm::SelectionDAGISel::CodeGenAndEmitDAG() llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:848:13
#20 0x00007f29f529db29 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, true>, llvm::ilist_iterator<llvm::ilist_detail:\
:node_options<llvm::Instruction, true, false, void>, false, true>, bool&) llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:702:1
#21 0x00007f29f529d504 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1705:11
#22 0x00007f29f529a990 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:482:3
#23 0x00007f29f8329ca7 (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:192:7
#24 0x00007f29f453a58c llvm::MachineFunctionPass::runOnFunction(llvm::Function&) llvm/lib/CodeGen/MachineFunctionPass.cpp:91:8
#25 0x00007f29f180bb85 llvm::FPPassManager::runOnFunction(llvm::Function&) llvm/lib/IR/LegacyPassManager.cpp:1435:23
#26 0x00007f29f18110bf llvm::FPPassManager::runOnModule(llvm::Module&) llvm/lib/IR/LegacyPassManager.cpp:1481:16
#27 0x00007f29f180c4fb (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) llvm/lib/IR/LegacyPassManager.cpp:1550:23
#28 0x00007f29f180c00a llvm::legacy::PassManagerImpl::run(llvm::Module&) llvm/lib/IR/LegacyPassManager.cpp:535:16
#29 0x00007f29f18113c1 llvm::legacy::PassManager::run(llvm::Module&) llvm/lib/IR/LegacyPassManager.cpp:1677:3
#30 0x0000564fb7365e4f compileModule(char**, llvm::LLVMContext&) llvm/tools/llc/llc.cpp:754:41
#31 0x0000564fb73640b5 main llvm/tools/llc/llc.cpp:416:13
#32 0x00007f29f0371eea (/usr/lib64/libc.so.6+0x23eea)
#33 0x00007f29f0371fa5 __libc_start_main (/usr/lib64/libc.so.6+0x23fa5)
#34 0x0000564fb7363891 _start (llc+0x2e891)
Aborted (core dumped)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMWVtT27ra_jXiRkNGR0u-4CIkpIsZ-GCgZfWOkW058aoiZ2SZQ3_9N7KdOHbDJtCuPbvTSYgsP-_znnVQVVUsrdZngJ8DPj9RtV-V7uwflZaJeUUnSZm9noEItf-NeVoDNAdo6pVbag-9KzZGQ0DnEBDyIqPHiAFC2jntZ6bzwmoIxDkEdMbgCywwoBeAzAa_IRBzCBjS1rtXQOTwGeEKkDjIaAWf5lr52ukqCKPz8EnO1dMLxyQHhHTSzqEtoaoq7XxRWvi80hZmRaUSo7OWHAzQecM_VcYczTIYYlKrLJs8F341KZ-0y035PHliBT5MfozTarRl4bQ_UjbheWddMR-aOTXKHW_nD2gwhtjx3sXF4Z-EQWNSePqkXRXsDwiFVCQi1kLEOWMix6nATOUij5HQQhGdShZlOFMdxNXVwzUERK683wA6BWQByKJhXrpl8ysOw50Rm9lbYVhM0IRuH80vzr99gUldmAwGffuoqCa7OTpXtfGwjTBAp7CN59Pa_rDlsz01ha1fTpe23r7xV1l5OLv9Fub-tE_asaHmTm9cOTEGnt50ChmThslNHpGFKRJAFl9beWTxXUbt5-W9Nlfls3aFXU7STVCdcMlFePV-_qBMrWHz_OH-4utsBojsRoOn0tJWHn6X0X2ddFkKSBSe3Guj06DzfPqlHQvWg9NdggTXEfnw9WaDJkvt71NllLsvfupLe174KoRFSEJ6Ef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