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

    <tr>
        <th>Summary</th>
        <td>
            [mlir][transform] --transform-preload-library crashed with  "LLVM ERROR"
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            mlir
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          wangzhiyingh
      </td>
    </tr>
</table>

<pre>
    git version: eb601430d3d7f45c30ef8d793a45cbcedf910577

system: `Ubuntu 20.04.6 LTS (Focal Fossa)`

reproduced with: `mlir-opt --transform-preload-library a.mlir`

a.mlir:

`a.mlir is an empty file`

trace:

```
LLVM ERROR: Loading a dialect (transform) while in a multi-threaded execution context (maybe the PassManager): this can indicate a missing `dependentDialects` in a pass for example.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /data/cangku/llvm-project/build/bin/mlir-opt --transform-preload-library bug.mlir
 #0 0x0000561f856d48bf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/cangku/llvm-project/build/bin/mlir-opt+0x15a18bf)
 #1 0x0000561f856d1954 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fdfa42ee420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x00007fdfa3dbb00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #4 0x00007fdfa3d9a859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #5 0x0000561f855e632a llvm::vfs::RedirectingFileSystem::create(llvm::ArrayRef<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, bool, llvm::vfs::FileSystem&) (.cold) VirtualFileSystem.cpp:0:0
 #6 0x0000561f883813c2 mlir::MLIRContext::getOrLoadDialect(llvm::StringRef, mlir::TypeID, llvm::function_ref<std::unique_ptr<mlir::Dialect, std::default_delete<mlir::Dialect>> ()>) (/data/cangku/llvm-project/build/bin/mlir-opt+0x424e3c2)
 #7 0x0000561f87566b53 (anonymous namespace)::PreloadLibraryPass::runOnOperation() PreloadLibraryPass.cpp:0:0
 #8 0x0000561f881899ce mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/cangku/llvm-project/build/bin/mlir-opt+0x40569ce)
 #9 0x0000561f88189eaa mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/cangku/llvm-project/build/bin/mlir-opt+0x4056eaa)
#10 0x0000561f8818a6d4 mlir::PassManager::run(mlir::Operation*) (/data/cangku/llvm-project/build/bin/mlir-opt+0x40576d4)
#11 0x0000561f8817af9b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#12 0x0000561f8817c454 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, llvm::ThreadPool*) MlirOptMain.cpp:0:0
#13 0x0000561f8817c604 mlir::LogicalResult llvm::function_ref<mlir::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::'lambda'(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#14 0x0000561f8827a894 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, bool, bool) (/data/cangku/llvm-project/build/bin/mlir-opt+0x4147894)
#15 0x0000561f881758d7 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/cangku/llvm-project/build/bin/mlir-opt+0x40428d7)
#16 0x0000561f8817c92b mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/cangku/llvm-project/build/bin/mlir-opt+0x404992b)
#17 0x0000561f8560d48b main (/data/cangku/llvm-project/build/bin/mlir-opt+0x14da48b)
#18 0x00007fdfa3d9c083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#19 0x0000561f856a526e _start (/data/cangku/llvm-project/build/bin/mlir-opt+0x157226e)
Aborted (core dumped)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWN1S4zoSfhrnRkVKkf8vcpGBSe1UQUEBe25TbantaEeRvJI8Q_bpt2SHxA4ww55Dzc4uBTiRWv3zqfWp3eCcbDTiMko_RenVDDq_NXb5HXTzr63cS91sZ5UR-2UjPfmG1kmjo3hFsMroIompiEVeJymPKdaFyMsYkpRXHEVdLmia5xG9iuhq-O_2zuMurI4y-veq074jjM5pMs_I9eMDiVixNhwUWRvnIGJllNHxeoutNaLjKMh36bcHRTsl7YVpPbm48Ba0q43dXbQWlQFxoWRlwe4JzIPYmb7DYLwaD0YZHcaJdAQ0wV3r96SWCs9WewscXy4-_PZfr6__uCGf7-9v74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