| Issue |
71184
|
| Summary |
llc assertion failures with X86 target
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
neboat
|
I'm encountering a couple assertion failures with llc, during codegen for the X86 target, on some simple LLVM input. I originally encountered the crash in clang 16.0.6, and I derived two similar reduced bitcodes — using `llvm-reduce` and using `bugpoint` — that trigger different llc assertion failures. I confirmed that both reduced bitcodes continue to trigger llc assertion failures on the release/17.x and main branches.
Below are the assertion failures I'm getting from llc built from the main branch (commit 05a47706476f). I'm seeing similar assertion failures from llc built from release/17.x (commit 309d55140c46).
Here are the two inputs:
[bug1.ll.txt](https://github.com/llvm/llvm-project/files/13251171/bug1.ll.txt)
[bug2.ll.txt](https://github.com/llvm/llvm-project/files/13251172/bug2.ll.txt)
Here's the first assertion failure, from running `llc bug1.ll`:
```
$ llc bug1.ll
/usr/bin/../lib/gcc/x86_64-redhat-linux/13/../../../../include/c++/13/bits/stl_vector.h:1125: reference std::vector<llvm::SUnit>::operator[](size_type) [_Tp = llvm::SUnit, _Alloc = std::allocator<llvm::SUnit>]: Assertion '__n < this->size()' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /data/work/llvm-project/build/bin/llc bug1.bc
1. Running pass 'Function Pass Manager' on module 'bug1.bc'.
2. Running pass 'X86 DAG->DAG Instruction Selection' on function '@split'
#0 0x0000000002640ec4 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/work/llvm-project/build/bin/llc+0x2640ec4)
#1 0x000000000263ea6e llvm::sys::RunSignalHandlers() (/data/work/llvm-project/build/bin/llc+0x263ea6e)
#2 0x0000000002641398 SignalHandler(int) Signals.cpp:0:0
#3 0x00007f88d425eba0 __restore_rt (/lib64/libc.so.6+0x3dba0)
#4 0x00007f88d42afb94 __pthread_kill_implementation (/lib64/libc.so.6+0x8eb94)
#5 0x00007f88d425eaee gsignal (/lib64/libc.so.6+0x3daee)
#6 0x00007f88d424787f abort (/lib64/libc.so.6+0x2687f)
#7 0x00007f88d44df1a0 __gnu_debug::_Safe_sequence_base::_M_get_mutex() (/lib64/libstdc++.so.6+0xdf1a0)
#8 0x000000000239c024 llvm::ScheduleDAGSDNodes::AddSchedEdges() (/data/work/llvm-project/build/bin/llc+0x239c024)
#9 0x000000000238d258 (anonymous namespace)::ScheduleDAGRRList::Schedule() ScheduleDAGRRList.cpp:0:0
#10 0x000000000246d6c7 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/data/work/llvm-project/build/bin/llc+0x246d6c7)
#11 0x000000000246aeb6 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/data/work/llvm-project/build/bin/llc+0x246aeb6)
#12 0x0000000002467c22 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/data/work/llvm-project/build/bin/llc+0x2467c22)
#13 0x00000000014cf0b9 (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) X86ISelDAGToDAG.cpp:0:0
#14 0x0000000001a1e209 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/data/work/llvm-project/build/bin/llc+0x1a1e209)
#15 0x0000000001f45447 llvm::FPPassManager::runOnFunction(llvm::Function&) (/data/work/llvm-project/build/bin/llc+0x1f45447)
#16 0x0000000001f4da22 llvm::FPPassManager::runOnModule(llvm::Module&) (/data/work/llvm-project/build/bin/llc+0x1f4da22)
#17 0x0000000001f45f57 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/data/work/llvm-project/build/bin/llc+0x1f45f57)
#18 0x00000000012070ad main (/data/work/llvm-project/build/bin/llc+0x12070ad)
#19 0x00007f88d4248b4a __libc_start_call_main (/lib64/libc.so.6+0x27b4a)
#20 0x00007f88d4248c0b __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x27c0b)
#21 0x0000000001201aa5 _start (/data/work/llvm-project/build/bin/llc+0x1201aa5)
Aborted (core dumped)
```
Here's the second assertion failure, from `llc bug2.ll`:
```
$ llc bug2.ll
llc: /data/work/llvm-project/build/lib/Target/X86/X86GenAsmWriter.inc:56713: static const char *llvm::X86ATTInstPrinter::getRegisterName(MCRegister): Assertion `RegNo && RegNo < 292 && "Invalid register number!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /data/work/llvm-project/build/bin/llc bug2.bc
1. Running pass 'Function Pass Manager' on module 'bug2.bc'.
2. Running pass 'X86 Assembly Printer' on function '@allocate'
#0 0x0000000002640ec4 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/work/llvm-project/build/bin/llc+0x2640ec4)
#1 0x000000000263ea6e llvm::sys::RunSignalHandlers() (/data/work/llvm-project/build/bin/llc+0x263ea6e)
#2 0x0000000002641398 SignalHandler(int) Signals.cpp:0:0
#3 0x00007f7426c5eba0 __restore_rt (/lib64/libc.so.6+0x3dba0)
#4 0x00007f7426cafb94 __pthread_kill_implementation (/lib64/libc.so.6+0x8eb94)
#5 0x00007f7426c5eaee gsignal (/lib64/libc.so.6+0x3daee)
#6 0x00007f7426c4787f abort (/lib64/libc.so.6+0x2687f)
#7 0x00007f7426c4779b _nl_load_domain.cold (/lib64/libc.so.6+0x2679b)
#8 0x00007f7426c57177 (/lib64/libc.so.6+0x36177)
#9 0x000000000155b14e llvm::X86ATTInstPrinter::printRegName(llvm::raw_ostream&, llvm::MCRegister) const X86ATTInstPrinter.cpp:0:0
#10 0x0000000001558de1 llvm::X86ATTInstPrinter::printInstruction(llvm::MCInst const*, unsigned long, llvm::raw_ostream&) X86ATTInstPrinter.cpp:0:0
#11 0x000000000155b24c llvm::X86ATTInstPrinter::printInst(llvm::MCInst const*, unsigned long, llvm::StringRef, llvm::MCSubtargetInfo const&, llvm::raw_ostream&) X86ATTInstPrinter.cpp:0:0
#12 0x000000000205b535 llvm::MCTargetStreamer::prettyPrintAsm(llvm::MCInstPrinter&, unsigned long, llvm::MCInst const&, llvm::MCSubtargetInfo const&, llvm::raw_ostream&) (/data/work/llvm-project/build/bin/llc+0x205b535)
#13 0x000000000200c1c7 (anonymous namespace)::MCAsmStreamer::emitInstruction(llvm::MCInst const&, llvm::MCSubtargetInfo const&) MCAsmStreamer.cpp:0:0
#14 0x00000000012305c2 llvm::X86AsmPrinter::EmitAndCountInstruction(llvm::MCInst&) X86MCInstLower.cpp:0:0
#15 0x0000000001232f2b llvm::X86AsmPrinter::emitInstruction(llvm::MachineInstr const*) X86MCInstLower.cpp:0:0
#16 0x000000000177ca31 llvm::AsmPrinter::emitFunctionBody() (/data/work/llvm-project/build/bin/llc+0x177ca31)
#17 0x000000000122c8e6 llvm::X86AsmPrinter::runOnMachineFunction(llvm::MachineFunction&) X86AsmPrinter.cpp:0:0
#18 0x0000000001a1e209 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/data/work/llvm-project/build/bin/llc+0x1a1e209)
#19 0x0000000001f45447 llvm::FPPassManager::runOnFunction(llvm::Function&) (/data/work/llvm-project/build/bin/llc+0x1f45447)
#20 0x0000000001f4da22 llvm::FPPassManager::runOnModule(llvm::Module&) (/data/work/llvm-project/build/bin/llc+0x1f4da22)
#21 0x0000000001f45f57 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/data/work/llvm-project/build/bin/llc+0x1f45f57)
#22 0x00000000012070ad main (/data/work/llvm-project/build/bin/llc+0x12070ad)
#23 0x00007f7426c48b4a __libc_start_call_main (/lib64/libc.so.6+0x27b4a)
#24 0x00007f7426c48c0b __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x27c0b)
#25 0x0000000001201aa5 _start (/data/work/llvm-project/build/bin/llc+0x1201aa5)
Aborted (core dumped)
```
Please let me know if you need any more information.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs