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

    <tr>
        <th>Summary</th>
        <td>
            The instruction schedulers `VLIW scheduler` 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 `--pre-RA-sched` with value `vliw-td` will trigger a crash.
Problem may exist in `VLIW scheduler`(selected by `vliw-td`) since other candidate schedulers (values) work fine. 
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 --pre-RA-sched=vliw-td /mnt/data/acpi_listen.bc -o /mnt/data/acpi_listen.s`

trace:
```s
 llc: /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/CodeGen/SelectionDAG/ResourcePriorityQueue.cpp:52: llvm::ResourcePriorityQueue::ResourcePriorityQueue(llvm::SelectionDAGISel*): Assertion `ResourcesModel && "Unimplemented CreateTargetScheduleState."' failed.
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 --pre-RA-sched=vliw-td /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 'X86 DAG->DAG Instruction Selection' on function '@handle_cmdline'
 #0 0x000063558027fcb8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/Support/Unix/Signals.inc:723:22
 #1 0x00006355802800d9 PrintStackTraceSignalHandler(void*) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/Support/Unix/Signals.inc:798:1
 #2 0x000063558027d529 llvm::sys::RunSignalHandlers() /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/Support/Signals.cpp:105:20
 #3 0x000063558027f550 SignalHandler(int) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/Support/Unix/Signals.inc:413:1
 #4 0x00007a1890a42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #5 0x00007a1890a969fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #6 0x00007a1890a969fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #7 0x00007a1890a969fc pthread_kill ./nptl/pthread_kill.c:89:10
 #8 0x00007a1890a42476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #9 0x00007a1890a287f3 abort ./stdlib/abort.c:81:7
#10 0x00007a1890a2871b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#11 0x00007a1890a39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#12 0x00006355800f1ac5 llvm::ResourcePriorityQueue::ResourcePriorityQueue(llvm::SelectionDAGISel*) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/CodeGen/SelectionDAG/ResourcePriorityQueue.cpp:54:20
#13 0x000063557ff08084 llvm::createVLIWDAGScheduler(llvm::SelectionDAGISel*, llvm::CodeGenOptLevel) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGVLIW.cpp:270:76
#14 0x000063558000507a llvm::SelectionDAGISel::CreateScheduler() /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:2043:1
#15 0x000063557fffeeed llvm::SelectionDAGISel::CodeGenAndEmitDAG() /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:998:50
#16 0x000063557fffd179 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&) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:739:1
#17 0x0000635580003003 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1756:33
#18 0x000063557fffbb46 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:517:7
#19 0x000063557dbe282f (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:192:0
#20 0x000063557ed78992 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/CodeGen/MachineFunctionPass.cpp:93:33
#21 0x000063557f559692 llvm::FPPassManager::runOnFunction(llvm::Function&) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/IR/LegacyPassManager.cpp:1443:20
#22 0x000063557f559968 llvm::FPPassManager::runOnModule(llvm::Module&) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/IR/LegacyPassManager.cpp:1489:13
#23 0x000063557f559dc9 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/IR/LegacyPassManager.cpp:1558:20
#24 0x000063557f554a44 llvm::legacy::PassManagerImpl::run(llvm::Module&) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/IR/LegacyPassManager.cpp:541:13
#25 0x000063557f55a6bf llvm::legacy::PassManager::run(llvm::Module&) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/IR/LegacyPassManager.cpp:1686:1
#26 0x000063557bf8aac2 compileModule(char**, llvm::LLVMContext&) /mnt/llvm-project-llvmorg-18.1.2/llvm/tools/llc/llc.cpp:745:34
#27 0x000063557bf882da main /mnt/llvm-project-llvmorg-18.1.2/llvm/tools/llc/llc.cpp:412:35
#28 0x00007a1890a29d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#29 0x00007a1890a29e40 call_init ./csu/../csu/libc-start.c:128:20
#30 0x00007a1890a29e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#31 0x000063557bf86fa5 _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/eJzMWV1v2zgW_TXMC2GDor4f_KDGdbZAgskmndnuk0CJtM0tRQok1ST_fkFKtj6aTTrdJjNF4diUdO45916S91LEGH6QjG1A_AHE2wvS2aPSm89P7N-MHC8qRZ829sigai1XEoIErVatZqu7YmXqI6MgQfCB2yP8RkTH3PVvgj-s7HBBCGg1PxyYhgTWmpjjGqAtQMWtVpVgDWzIE2SP3FjIPfof15_-BT1yJ5gGCQI4M0yw2jIKq6e5AYBzaLisGVT2yDSsiaScEstGBAMBzjw34-5-UPor3HPJ1rDncek4wSMxsGJQs1Yr2tWMDmyE-NasgmwdrLE3dzkOJk4gkXQciUCCBnX9590I51wEwmHcQ-0aaQHe-Udbrf7DartyP5Q-nCziXdVxQd1fLv29NVx4P9wO3oBnREosAXhH6paXghvL5Lqq4Uq9eIdxnCbUrSY1mxH2_03_GwpRg7CAP6jCDbg_vAJ4d6kou2JOzr0PK1dyW1wBvLtjRnW6ZreaK83t0z871rF13bYgLGLszHmcsABh8ey9L13C2fjw1O6neyYALgDOnYHCGKZPeX4CMjeKMgEBTgBOIMD4d8mbVrCGSZeTl5oRyz4TfWD2fsi6e0ssWwOMAU7hnnDB6Cntrz8W9x-h6aqGW0hg1R1c1iltoVXwaG1rHEm8A3h34PbYVetaNRMfThwN8I4b4xN75zORy1p0lE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