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

    <tr>
        <th>Summary</th>
        <td>
            Assertion `SDNode::getMaxNumOperands() >= Vals.size() && "too many operands to fit into SDNode"' failed.
        </td>
    </tr>

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

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

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

<pre>
    # Description
The following code crashes x86_64 backend with "Assertion `SDNode::getMaxNumOperands() >= Vals.size() && "too many operands to fit into SDNode"' failed."

# Minimal Reproduction
https://godbolt.org/z/rzbvW7ovK

## code
```
; ModuleID = 'Fuzzer input'
source_filename = "M"

@G = global i1 false
@G.1 = global i8312747 0

define i16 @f(i32 %0, i8 %1, i32 %2, i32 %3, float %4) {
BB:
  %A = alloca ptr, align 8
  %L3 = load i16, ptr %A, align 2
  store ptr undef, ptr %A, align 8
  %G4 = getelementptr i8, ptr %A, i16 %L3
  %RP = alloca i16, align 2
  %L2 = load i32, ptr %RP, align 4
  %L1 = load i1, ptr %RP, align 1
 %CastPtrToI = ptrtoint ptr %RP to i8312747
  %5 = load i16, ptr %RP, align 2
  %B = or i16 %5, -1
  br label %BB1

BB1: ; preds = %BB
  store i16 %B, ptr %G4, align 2
 %C = icmp sgt i1 true, %L1
  %CastExt = zext i16 %B to i32
  store i1 %C, ptr @G, align 1
  store i8312747 %CastPtrToI, ptr @G.1, align 4
 %G = getelementptr i1, ptr %RP, i32 %L2
  store ptr %G, ptr %A, align 8
  store i32 %CastExt, ptr %G, align 4
  ret i16 %5
}
```
## Stack Trace
```
llc: /root/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:12973: void llvm::SelectionDAG::createOperands(llvm::SDNode*, llvm::ArrayRef<llvm::SDValue>): Assertion `SDNode::getMaxNumOperands() >= Vals.size() && "too many operands to fit into SDNode"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -mtriple x86_64 -O=0 <source>
1.      Running pass 'Function Pass Manager' on module '<source>'.
2.      Running pass 'X86 DAG->DAG Instruction Selection' on function '@f'
 #0 0x00000000039c14d8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x39c14d8)
 #1 0x00000000039bec1c SignalHandler(int) Signals.cpp:0:0
 #2 0x00007983a9442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007983a94969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x00007983a9442476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007983a94287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x00007983a942871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #7 0x00007983a9439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #8 0x000000000372870a llvm::SelectionDAG::createOperands(llvm::SDNode*, llvm::ArrayRef<llvm::SDValue>) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x372870a)
 #9 0x000000000374d05b llvm::SelectionDAG::getNode(unsigned int, llvm::SDLoc const&, llvm::EVT, llvm::ArrayRef<llvm::SDValue>, llvm::SDNodeFlags) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x374d05b)
#10 0x00000000036adf0b llvm::RegsForValue::getCopyToRegs(llvm::SDValue, llvm::SelectionDAG&, llvm::SDLoc const&, llvm::SDValue&, llvm::SDValue*, llvm::Value const*, llvm::ISD::NodeType) const (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x36adf0b)
#11 0x00000000036c6576 llvm::SelectionDAGBuilder::CopyValueToVirtualRegister(llvm::Value const*, unsigned int, llvm::ISD::NodeType) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x36c6576)
#12 0x0000000003703d65 llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3703d65)
#13 0x000000000378b66d llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void, true>, false, true>, llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void, true>, false, true>, bool&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x378b66d)
#14 0x000000000378c6fd llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x378c6fd)
#15 0x000000000378e13f llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#16 0x0000000001e74d0c (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) X86ISelDAGToDAG.cpp:0:0
#17 0x00000000029cbe91 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#18 0x0000000002f8f3c3 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2f8f3c3)
#19 0x0000000002f8f601 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2f8f601)
#20 0x0000000002f8fe65 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2f8fe65)
#21 0x0000000000829aac compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#22 0x0000000000727c86 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x727c86)
#23 0x00007983a9429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#24 0x00007983a9429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#25 0x000000000082085e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x82085e)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMWd1S4zoSfhpzo0rKlv8vcpEQwlILZyig2HOXku2O0Y4suSSZAZ5-S7KTWCbMGXbZUzM1M9hS99df_0gtC6IUrTnAwotXXrw-I51-EnKxpvU3uRb1WSGq14WHQ7QGVUraaiq45689f_nwBGgnGBM_KK9RKSpApSTqCRR6yZJtEqGClN-BV-gH1U_Iw3ipFEgDgLzEv1__ISrwwqUXLmvQN-Tlj6751oIkvFIezjycIy-88MI1eiRMzRV9g_0wTjycGEQtBGoIf0ViUERaoB3ViHIt0GACYw-naEcog2pu3iz94X8cohvKaUMYuoNWiqorjy4-ad0qQxFvPLypRVUIpudC1h7evHl4I9-K53-l4vmfE0iDagIyDCT-8Ld_DVfoRlQdg6s1Mu55ON10b28gEeVtpz2c9oJKdLKE7Y4y4KSBQRbfTF2I_Es7VzNREIZogHaEKTjOzgNnPgsDnEYp8scoFewoB0SDBHmRv_NwRkOMPBz7Hj5HNDOPgX3sh_HoOTTPOyaINm-RTVG66nFXKxM_-4jM7NJSIYyJkqBWS6NKGK05ykZS16EVY4JUhpIRarW0-kcFvFdQWkiwAh2vYHdaegx_GfUBAQ0MGuDaiNNsqmiDYciMVO9uxw4M3CZ8jA4eORDiEfLd7VEjGmsEY5c_UAgGBQ_H50TpWy0fxJXVa7XUgnJ91DJLYZ_rkZ34o8iO7YxdWVkFIffhiI3YbM8EFRIxUgCzoqtgXFPmNTQJX6FWQqWGCo5XKzdzA_BqROYyek_GOG0haNm0SNXalLqWHRhRG8ERaxOeixdt5d_gRR-M2LCEeMrA6hwIRP7l-6DvZffrx0nCWHUevE-x8elU0b3P9LCork-UtwH5i-oeOPYYQxDGcT1RfBL0Mbd9-tL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