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

    <tr>
        <th>Summary</th>
        <td>
            [mlir] -inline crashes in UNREACHABLE executed at /data/szy/MLIR/llvm-release/llvm-project/mlir/include/mlir/Transforms/InliningUtils.h:108!
        </td>
    </tr>

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

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

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

<pre>
    git version: 8168088f0a9015b

system: `Ubuntu 18.04.6 LTS`

reproduce with: `mlir-opt -inline a.mlir`

a.mlir:
``` 
llvm.func @test_muli() -> i32 attributes {llvm.emit_c_interface} {
 "test.branch"()[^bb1] {tag = "muli"} : () -> ()
  ^bb1:  // pred: ^bb0
    %0 = llvm.mlir.constant(1 : i32) : i32
    llvm.return %0 : i32
  }
  llvm.func @_mlir_ciface_test_muli() -> i32 attributes {llvm.emit_c_interface} {
    %0 = llvm.call @test_muli() : () -> i32
 llvm.return %0 : i32
  }
``` 
stack trace:

``` 
must implement handleTerminator in the case of multiple inlined blocks
UNREACHABLE executed at /data/szy/MLIR/llvm-release/llvm-project/mlir/include/mlir/Transforms/InliningUtils.h:108!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.  Program arguments: /data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt -inline a.mlir
 #0 0x000055f72e1082c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10dc2c8)
 #1 0x000055f72e105dde llvm::sys::RunSignalHandlers() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10d9dde)
 #2 0x000055f72e108c5d SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f10769a2420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007f1075fdf00b raise /build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x00007f1075fbe859 abort /build/glibc-LcI20x/glibc-2.31/stdlib/abort.c:81:7
 #6 0x000055f72e12832f (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10fc32f)
 #7 0x000055f72e1f26c9 (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x11c66c9)
 #8 0x000055f7312b3c74 inlineRegionImpl(mlir::InlinerInterface&, mlir::Region*, mlir::Block*, llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Operation, true, false, void, false, void>, false, false>, mlir::IRMapping&, mlir::ValueRange, mlir::TypeRange, std::optional<mlir::Location>, bool, mlir::CallOpInterface) InliningUtils.cpp:0:0
 #9 0x000055f7312b4b6a mlir::inlineCall(mlir::InlinerInterface&, mlir::CallOpInterface, mlir::CallableOpInterface, mlir::Region*, bool) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x4288b6a)
#10 0x000055f7312ad6eb mlir::Inliner::doInlining() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x42816eb)
#11 0x000055f731255575 (anonymous namespace)::InlinerPass::runOnOperation() InlinerPass.cpp:0:0
#12 0x000055f73122f156 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x4203156)
#13 0x000055f73122fac0 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x4203ac0)
#14 0x000055f731232102 mlir::PassManager::run(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x4206102)
#15 0x000055f73122a931 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#16 0x000055f73122a58b llvm::LogicalResult llvm::function_ref<llvm::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&)::$_0>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#17 0x000055f7312d6f25 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x42aaf25)
#18 0x000055f7312259b5 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41f99b5)
#19 0x000055f731225c5f mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41f9c5f)
#20 0x000055f731225f8e mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x41f9f8e)
#21 0x000055f72e0e8f07 main (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10bcf07)
#22 0x00007f1075fc0083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#23 0x000055f72e0e8a8e _start (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10bca8e)
``` 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWd1y4yoSfhpyQ8WF0I-lC184P66TqmSTSjJ7q0IIyewg0AKak-zTbwGyLdnJnJlT4z27WzUTS9B0f_11Ny0hYgxvJWMrkF6B9OaCDHar9Iq8MVLRi0rV76uWW_iNacOVBPEa5lGWozxvEClQlFYA3QC0Dn_Nu7Gsc0IgQ1-qQdoBRvkCJYsM3r--gAxNpTXrtaoHyuDv3G7HVZ3g-lL1Fl5yKbhkkCzc0NHScTAeb92s_wfDvRDfukUzSApBgiwztuwGwQHOAS7gJYhvIY8xJNZqXg2WGQiWV34N67gtacmlZbohlIHljZsLWiHA2ClbVJpIugUYB42euduqikDqpS1pIYhvnHgwi70a598Ewbg2aIajgthd4g3AG9hrVvs1bgbt5Nx0irx6D9jRsKBKGkukBTiPvB0eY2dnd7lf65doZgctd3pmEmB5s7ucUVg6MyXljpLy1_F54g0lQnwUsmPuDpB_2KPjFDGW0K_Qagdqn0YfSnaDsZB3vWAdkxZuiawFe2W645JYpSGX0G4ZpMQwqBrYDcLyXjAY8reGlVD0qwm6vvzt-XZ9_dv66v4WsjdGB8tqSKyLeU0sAXhj_vUO8Obh_u4Z4I3z7lIzwYhhu9teq38wagHe-BLAGy6pGGp2GHjVRJpG6c4AvLlzKLhsv1guzMJVWYRygKOA5-n-dv1yC81QddxCAquhhZr1SltoFdxa2xvHjs_IltvtUC2o6kYop4i4MQNzViGRNRyBBXY0MVtYEfrVU74I5l98EOqh6_cxQAsIn7RqNekg0e3gODch_n-Comrgona_XI78fLS37Ko7RhC9IYRQmjZLzCKUY5r7FHPwYre9hYsnzaX14F99AuH8IKTJ76Uy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