| Issue |
58171
|
| Summary |
[R600] Allocating Large Number of `i1`'s on Stack Crashes with Error "Register number out of range"
|
| Labels |
|
| Assignees |
|
| Reporter |
HazyFish
|
## Description
Allocating more than 504 `i1`'s on stack crashes with Error "Register number out of range" when interacting with other code.
## Minimal Reproduction
https://godbolt.org/z/6nzxW74Yh
### Code
```ll
define void @f() {
BB:
br label %BB1
BB1: ; preds = %BB1, %BB
br i1 false, label %BB1, label %BB2
BB2: ; preds = %BB1
%A = alloca i1, i32 505 ; any number greater than 504 fails
%G = getelementptr i1, i1* %A, i32 1
%B = ashr i1 false, true
store i1 %B, i1* %G
ret void
}
```
### Stack Trace
```
llc: /home/henry/aflplusplus-isel/llvm-project/llvm/include/llvm/MC/MCRegisterInfo.h:62: unsigned int llvm::MCRegisterClass::getRegister(unsigned int) const: Assertion `i < getNumRegs() && "Register number out of range!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: ./llvm-project/build-debug/bin/llc ./crash-reports/dagisel-r600/1.ll -mtriple=r600
1. Running pass 'Function Pass Manager' on module './crash-reports/dagisel-r600/1.ll'.
2. Running pass 'Finalize ISel and expand pseudo-instructions' on function '@f'
#0 0x0000000003adad2a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/Support/Unix/Signals.inc:569:11
#1 0x0000000003adaedb PrintStackTraceSignalHandler(void*) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/Support/Unix/Signals.inc:636:1
#2 0x0000000003ad9526 llvm::sys::RunSignalHandlers() /home/henry/aflplusplus-isel/llvm-project/llvm/lib/Support/Signals.cpp:103:5
#3 0x0000000003adb605 SignalHandler(int) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1
#4 0x00007f119b726980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
#5 0x00007f119a616e87 raise /build/glibc-uZu3wS/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#6 0x00007f119a6187f1 abort /build/glibc-uZu3wS/glibc-2.27/stdlib/abort.c:81:0
#7 0x00007f119a6083fa __assert_fail_base /build/glibc-uZu3wS/glibc-2.27/assert/assert.c:89:0
#8 0x00007f119a608472 (/lib/x86_64-linux-gnu/libc.so.6+0x30472)
#9 0x0000000000df1cd2 llvm::MCRegisterClass::getRegister(unsigned int) const /home/henry/aflplusplus-isel/llvm-project/llvm/include/llvm/MC/MCRegisterInfo.h:0:5
#10 0x0000000001432a5e llvm::TargetRegisterClass::getRegister(unsigned int) const /home/henry/aflplusplus-isel/llvm-project/llvm/include/llvm/CodeGen/TargetRegisterInfo.h:92:16
#11 0x000000000190945d llvm::R600InstrInfo::reserveIndirectRegisters(llvm::BitVector&, llvm::MachineFunction const&, llvm::R600RegisterInfo const&) const /home/henry/aflplusplus-isel/llvm-project/llvm/lib/Target/AMDGPU/R600InstrInfo.cpp:1077:48
#12 0x0000000001928292 llvm::R600RegisterInfo::getReservedRegs(llvm::MachineFunction const&) const /home/henry/aflplusplus-isel/llvm-project/llvm/lib/Target/AMDGPU/R600RegisterInfo.cpp:62:3
#13 0x00000000029574fe llvm::MachineRegisterInfo::freezeReservedRegs(llvm::MachineFunction const&) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/CodeGen/MachineRegisterInfo.cpp:510:43
#14 0x0000000002bf43b5 llvm::TargetLoweringBase::finalizeLowering(llvm::MachineFunction&) const /home/henry/aflplusplus-isel/llvm-project/llvm/lib/CodeGen/TargetLoweringBase.cpp:2208:1
#15 0x00000000026f248c (anonymous namespace)::FinalizeISel::runOnMachineFunction(llvm::MachineFunction&) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/CodeGen/FinalizeISel.cpp:74:10
#16 0x0000000002894c85 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:91:8
#17 0x0000000002f797d6 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1430:23
#18 0x0000000002f7e602 llvm::FPPassManager::runOnModule(llvm::Module&) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1476:16
#19 0x0000000002f7a0a9 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1545:23
#20 0x0000000002f79c1d llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:535:16
#21 0x0000000002f7e8e1 llvm::legacy::PassManager::run(llvm::Module&) /home/henry/aflplusplus-isel/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1672:3
#22 0x0000000000d2cdbc compileModule(char**, llvm::LLVMContext&) /home/henry/aflplusplus-isel/llvm-project/llvm/tools/llc/llc.cpp:737:41
#23 0x0000000000d2b162 main /home/henry/aflplusplus-isel/llvm-project/llvm/tools/llc/llc.cpp:418:13
#24 0x00007f119a5f9c87 __libc_start_main /build/glibc-uZu3wS/glibc-2.27/csu/../csu/libc-start.c:344:0
#25 0x0000000000d2a96a _start (./llvm-project/build-debug/bin/llc+0xd2a96a)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs