<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/87055>87055</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
The "global" instruction selector option crashes `llc`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
TyeYeah
</td>
</tr>
</table>
<pre>
the option `--global-isel` will trigger a crash.
Crash has be reproduced in `llvm-18.1.2`, `llvm-16` and `llvm-14`.
Reproduced with:
`/mnt/llvm-project-llvmorg-18.1.2/build/bin/llc --global-isel /mnt/data/acpi_listen.bc -o /mnt/data/acpi_listen.s`
trace:
```s
LLVM ERROR: unable to legalize instruction: G_BRJT %23:_(p0), %jump-table.0, %19:_(s64) (in function: handle_cmdline)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /mnt/llvm-project-llvmorg-18.1.2/build/bin/llc --global-isel /mnt/data/acpi_listen.bc -o /mnt/data/acpi_listen.s
1. Running pass 'Function Pass Manager' on module '/mnt/data/acpi_listen.bc'.
2. Running pass 'Legalizer' on function '@handle_cmdline'
#0 0x0000566073034cb8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/Support/Unix/Signals.inc:723:22
#1 0x00005660730350d9 PrintStackTraceSignalHandler(void*) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/Support/Unix/Signals.inc:798:1
#2 0x0000566073032529 llvm::sys::RunSignalHandlers() /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/Support/Signals.cpp:105:20
#3 0x0000566073034550 SignalHandler(int) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/Support/Unix/Signals.inc:413:1
#4 0x00007d40fba42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#5 0x00007d40fba969fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#6 0x00007d40fba969fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
#7 0x00007d40fba969fc pthread_kill ./nptl/pthread_kill.c:89:10
#8 0x00007d40fba42476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
#9 0x00007d40fba287f3 abort ./stdlib/abort.c:81:7
#10 0x0000566072f5ae4b llvm::report_fatal_error(llvm::Twine const&, bool) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/Support/ErrorHandling.cpp:125:9
#11 0x0000566073b630a0 reportGISelDiagnostic(llvm::DiagnosticSeverity, llvm::MachineFunction&, llvm::TargetPassConfig const&, llvm::MachineOptimizationRemarkEmitter&, llvm::MachineOptimizationRemarkMissed&) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/CodeGen/GlobalISel/Utils.cpp:264:14
#12 0x0000566073b63164 llvm::reportGISelFailure(llvm::MachineFunction&, llvm::TargetPassConfig const&, llvm::MachineOptimizationRemarkEmitter&, llvm::MachineOptimizationRemarkMissed&) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/CodeGen/GlobalISel/Utils.cpp:278:1
#13 0x0000566073b633a8 llvm::reportGISelFailure(llvm::MachineFunction&, llvm::TargetPassConfig const&, llvm::MachineOptimizationRemarkEmitter&, char const*, llvm::StringRef, llvm::MachineInstr const&) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/CodeGen/GlobalISel/Utils.cpp:291:1
#14 0x0000566073ada95f llvm::Legalizer::runOnMachineFunction(llvm::MachineFunction&) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp:352:23
#15 0x0000566071b2d992 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/CodeGen/MachineFunctionPass.cpp:93:33
#16 0x000056607230e692 llvm::FPPassManager::runOnFunction(llvm::Function&) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/IR/LegacyPassManager.cpp:1443:20
#17 0x000056607230e968 llvm::FPPassManager::runOnModule(llvm::Module&) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/IR/LegacyPassManager.cpp:1489:13
#18 0x000056607230edc9 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/IR/LegacyPassManager.cpp:1558:20
#19 0x0000566072309a44 llvm::legacy::PassManagerImpl::run(llvm::Module&) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/IR/LegacyPassManager.cpp:541:13
#20 0x000056607230f6bf llvm::legacy::PassManager::run(llvm::Module&) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/IR/LegacyPassManager.cpp:1686:1
#21 0x000056606ed3fac2 compileModule(char**, llvm::LLVMContext&) /mnt/llvm-project-llvmorg-18.1.2/llvm/tools/llc/llc.cpp:745:34
#22 0x000056606ed3d2da main /mnt/llvm-project-llvmorg-18.1.2/llvm/tools/llc/llc.cpp:412:35
#23 0x00007d40fba29d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#24 0x00007d40fba29e40 call_init ./csu/../csu/libc-start.c:128:20
#25 0x00007d40fba29e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#26 0x000056606ed3bfa5 _start (/mnt/llvm-project-llvmorg-18.1.2/build/bin/llc+0xae0fa5)
Aborted (core dumped)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWF1v2zgW_TXMC2GButTngx_cNu52kaCBkx1gnwxKomVOKUogqSaZX78gLUcf8XaKTrNbYIrCkWnq8JxzL3lJMmNErThfo_gdij9csd4eW71-eOb_5ux4VbTV89oeOW47K1qFUUJWq1q2BZMrYbhECcGPQkpstahrrjHDpWbmGCDyAZHNe_eMj8zggmPNO91WfckrLDySlF-bVZgFYQAoIQjej42JA2aqGlsilJAB9fS5G-EehT0iOrR7qG2jLIKtf7XT7e-8tCv3pdX1eUTYFr2QlfsrlO9b4pk2_AJTMcsQbFnZib0Ux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