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

    <tr>
        <th>Summary</th>
        <td>
            Enabling new pass manager and Printing IR before the pass conflict and crash `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 `--enable-new-pm` and `--print-before-pass-number` conflict and crash.
The value of `--print-before-pass-number` can be any int number.
Crash has be reproduced in `llvm-18.1.2`.

Reproduced with:
`/mnt/llvm-project-llvmorg-18.1.2/build/bin/llc --print-before-pass-number=116 --enable-new-pm  /mnt/data/acpi_listen.bc -o /mnt/data/acpi_listen.s`

trace:
```s
 Unknown wrapped IR type
UNREACHABLE executed at /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/Passes/StandardInstrumentations.cpp:265!
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 --print-before-pass-number=116 --enable-new-pm /mnt/data/acpi_listen.bc -o /mnt/data/acpi_listen.s
 #0 0x00005e3c8212acb8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/Support/Unix/Signals.inc:723:22
 #1 0x00005e3c8212b0d9 PrintStackTraceSignalHandler(void*) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/Support/Unix/Signals.inc:798:1
 #2 0x00005e3c82128529 llvm::sys::RunSignalHandlers() /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/Support/Signals.cpp:105:20
 #3 0x00005e3c8212a550 SignalHandler(int) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/Support/Unix/Signals.inc:413:1
 #4 0x00007d13e2e42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #5 0x00007d13e2e969fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #6 0x00007d13e2e969fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #7 0x00007d13e2e969fc pthread_kill ./nptl/pthread_kill.c:89:10
 #8 0x00007d13e2e42476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #9 0x00007d13e2e287f3 abort ./stdlib/abort.c:81:7
#10 0x00005e3c820511dd bindingsErrorHandler(void*, char const*, bool) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/Support/ErrorHandling.cpp:221:55
#11 0x00005e3c81821228 (anonymous namespace)::shouldPrintIR(llvm::Any) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/Passes/StandardInstrumentations.cpp:266:1
#12 0x00005e3c81823659 llvm::PrintIRInstrumentation::printBeforePass(llvm::StringRef, llvm::Any) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/Passes/StandardInstrumentations.cpp:812:7
#13 0x00005e3c818244bd llvm::PrintIRInstrumentation::registerCallbacks(llvm::PassInstrumentationCallbacks&)::'lambda'(llvm::StringRef, llvm::Any)::operator()(llvm::StringRef, llvm::Any) const /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/Passes/StandardInstrumentations.cpp:949:60
#14 0x00005e3c8183bef3 void llvm::detail::UniqueFunctionBase<void, llvm::StringRef, llvm::Any>::CallImpl<llvm::PrintIRInstrumentation::registerCallbacks(llvm::PassInstrumentationCallbacks&)::'lambda'(llvm::StringRef, llvm::Any)>(void*, llvm::StringRef, llvm::Any&) /mnt/llvm-project-llvmorg-18.1.2/llvm/include/llvm/ADT/FunctionExtras.h:221:16
#15 0x00005e3c803b4a8a llvm::unique_function<void (llvm::StringRef, llvm::Any)>::operator()(llvm::StringRef, llvm::Any) /mnt/llvm-project-llvmorg-18.1.2/llvm/include/llvm/ADT/FunctionExtras.h:385:62
#16 0x00005e3c80c88324 bool llvm::PassInstrumentation::runBeforePass<llvm::MachineFunction, llvm::detail::PassConcept<llvm::MachineFunction, llvm::MachineFunctionAnalysisManager>>(llvm::detail::PassConcept<llvm::MachineFunction, llvm::MachineFunctionAnalysisManager> const&, llvm::MachineFunction const&) const /mnt/llvm-project-llvmorg-18.1.2/llvm/include/llvm/IR/PassInstrumentation.h:241:30
#17 0x00005e3c80c8602b llvm::MachineFunctionPassManager::run(llvm::Module&, llvm::MachineFunctionAnalysisManager&) /mnt/llvm-project-llvmorg-18.1.2/llvm/lib/CodeGen/MachinePassManager.cpp:92:13
#18 0x00005e3c7de595f0 RunPasses(bool, llvm::ToolOutputFile*, llvm::Module*, llvm::LLVMContext&, llvm::SmallString<0u>&, llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>*, llvm::AnalysisManager<llvm::Module>*, llvm::MachineFunctionPassManager&, llvm::MachineFunctionAnalysisManager&) /mnt/llvm-project-llvmorg-18.1.2/llvm/tools/llc/NewPMDriver.cpp:106:12
#19 0x00005e3c7de5a402 llvm::compileModuleWithNewPM(llvm::StringRef, std::unique_ptr<llvm::Module, std::default_delete<llvm::Module>>, std::unique_ptr<llvm::MIRParser, std::default_delete<llvm::MIRParser>>, std::unique_ptr<llvm::TargetMachine, std::default_delete<llvm::TargetMachine>>, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>, llvm::LLVMContext&, llvm::TargetLibraryInfoImpl const&, bool, llvm::StringRef, llvm::CodeGenFileType) /mnt/llvm-project-llvmorg-18.1.2/llvm/tools/llc/NewPMDriver.cpp:226:14
#20 0x00005e3c7de3525b compileModule(char**, llvm::LLVMContext&) /mnt/llvm-project-llvmorg-18.1.2/llvm/tools/llc/llc.cpp:654:34
#21 0x00005e3c7de332da main /mnt/llvm-project-llvmorg-18.1.2/llvm/tools/llc/llc.cpp:412:35
#22 0x00007d13e2e29d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#23 0x00007d13e2e29e40 call_init ./csu/../csu/libc-start.c:128:20
#24 0x00007d13e2e29e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#25 0x00005e3c7de31fa5 _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/eJzUWV1v4ywW_jX0BiXCYDv2RS4yabJvpfbdqu3saq8ibEjCDgYv4Gnz71dgN7HdjzfTzsxqR6PGNnDOc57zhTG1VuwU53OQfAHJ5QVt3F6b-cOB_4vT_UWh2WHu9hzq2gmtIEjRZMIVLSSfKP44qSuQIkgVa0dqI5SbFHyrDZ_U1NqJaqqCGz-p1GorRenC7NJQu58CdAnQ4mHP4XcqGw719gwxVMGCQ6oOUCgH24FO0tJLhXtq_QzDa6NZU3IGRQAu5fdqEmXTaIpBirol7d-709xH4faAdM9BigBeV8oBvA7La6P_zUs38Tfa7J7F4XXRCMn8r1BhbgnfMYNcRlEKR0RCeFTFqKMAr2lZi40U1nE1LUo40e_OsB5szyZnaMkHloT_tr2HX9U3pR8VfDS0rjmDV3fQHWrejn798261WP6x-HK9gvyJl43jDFIHzyTDP_A_ogB4fUut5Rbg9b2jilHDrpR1pqm4ctTHlJ2WdQ3IAqcJwFGr__Z6tbhfQdsUlXCQwqLZeX9q46DTcO9cbb1leA3weifcvimmpa56mnvwAF4La5sAIcSeUKVsGIc-rEMcwoKW3wJdXVDcO1p-g6yp6iN_aArDv1ujd4ZWkJpdMMHjOJeWnxAjnw2R1vcAEwTRE0IIJZyUGY4wLYsMBvbIApCFPdj24tbjC3w8hHjC2WmSoY8bbZ3htAI4BXjpMxLg_ENhct_U3r8Ar78q8eQfiJ2i0k6FKgFZzDDxMYJPFkQjCwrEcjiC28r4gyomuQE4-64FA3jxqzDmGSCL6AQRjyBmCc5fI_muUQOkFuDs8xifwbXpFaHEE4hO6Mg4BJIEwTFjv86jcUSGbMUdnh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