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

    <tr>
        <th>Summary</th>
        <td>
            riscv32 crashes on huge alloca
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:RISC-V,
            llvm:crash
      </td>
    </tr>

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

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

<pre>
    ```
LLVM ERROR: Should only materialize 32-bit constants for RV32
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 <source>
1.      Running pass 'Function Pass Manager' on module '<source>'.
2.      Running pass 'Prologue/Epilogue Insertion & Frame Finalization' on function '@f'
 #0 0x000055aba2ce9ccf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3575ccf)
 #1 0x000055aba2ce7424 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f43b01fc420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x00007f43afcc900b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #4 0x00007f43afca8859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #5 0x000055ab9ff3fa88 llvm::SuffixTree::insertLeaf(llvm::SuffixTreeInternalNode&, unsigned int, unsigned int) (.cold) SuffixTree.cpp:0:0
 #6 0x000055aba2c3d18e (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x34c918e)
 #7 0x000055aba1051e8e llvm::RISCVInstrInfo::movImm(llvm::MachineBasicBlock&, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, llvm::DebugLoc const&, llvm::Register, unsigned long, llvm::MachineInstr::MIFlag) const (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x18dde8e)
 #8 0x000055aba1058d1f llvm::RISCVRegisterInfo::adjustReg(llvm::MachineBasicBlock&, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, llvm::DebugLoc const&, llvm::Register, llvm::Register, llvm::StackOffset, llvm::MachineInstr::MIFlag, llvm::MaybeAlign) const (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x18e4d1f)
 #9 0x000055aba109b316 llvm::RISCVFrameLowering::emitPrologue(llvm::MachineFunction&, llvm::MachineBasicBlock&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x1927316)
#10 0x000055aba20e8a3d (anonymous namespace)::PEI::runOnMachineFunction(llvm::MachineFunction&) PrologEpilogInserter.cpp:0:0
#11 0x000055aba1f7a47e llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#12 0x000055aba25103f1 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2d9c3f1)
#13 0x000055aba2510639 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2d9c639)
#14 0x000055aba2510eb2 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2d9ceb2)
#15 0x000055ab9fffc734 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
```

```llvm
target triple = "riscv32-unknown-linux-gnu"

define void @f() {
  %A = alloca i32, i32 -1
  ret void
}
```

https://godbolt.org/z/bx9o5GWrq
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUV91u87gRfRr6hrAhkfq98IXz49ZA0i9wFullQFEjmRuKVEkqn7NPX5BSEsvJdtM2LbCAA0sT-szhOQMOh1krWgWwRukFSq8WbHAHbdb80DDrFpWuX9Yoi6ZPdIWizc3Nwy2-3u9_7BHd4PuDHmSNtZIvuGMOjGBS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