llvm-project
llvm-project copied to clipboard
[mlir] Inline func.func that terminated with llvm.return crashes with "UNREACHABLE executed"
MLIR built at commit https://github.com/llvm/llvm-project/commit/159cac50 Reproduced with:
mlir-opt --inline temp.mlir
temp.mlir:
func.func @func() {
llvm.return
}
func.func @func1() {
call @func() : () -> ()
return
}
trace:
must implement handleTerminator in the case of one inlined block
UNREACHABLE executed at /Users/haoyu/workspace/mlir-fuzz/mlir/include/mlir/Transforms/InliningUtils.h:119!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: mlir-opt --inline temp.mlir
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 mlir-opt 0x0000000102890d04 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 mlir-opt 0x000000010288fd6c llvm::sys::RunSignalHandlers() + 112
2 mlir-opt 0x000000010289139c SignalHandler(int) + 344
3 libsystem_platform.dylib 0x00000001a56894c4 _sigtramp + 56
4 libsystem_pthread.dylib 0x00000001a5671ee0 pthread_kill + 288
5 libsystem_c.dylib 0x00000001a55ac340 abort + 168
6 mlir-opt 0x0000000102857c4c llvm::install_out_of_memory_new_handler() + 0
7 mlir-opt 0x00000001028d913c mlir::DialectInlinerInterface::materializeCallConversion(mlir::OpBuilder&, mlir::Value, mlir::Type, mlir::Location) const + 0
8 mlir-opt 0x0000000103b0a364 inlineRegionImpl(mlir::InlinerInterface&, mlir::Region*, mlir::Block*, llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Operation, true, false, void>, false, false>, mlir::IRMapping&, mlir::ValueRange, mlir::TypeRange, std::__1::optional<mlir::Location>, bool, mlir::Operation*) + 1320
9 mlir-opt 0x0000000103b0ad54 mlir::inlineCall(mlir::InlinerInterface&, mlir::CallOpInterface, mlir::CallableOpInterface, mlir::Region*, bool) + 1440
10 mlir-opt 0x0000000103ada6a4 (anonymous namespace)::InlinerPass::inlineSCC((anonymous namespace)::Inliner&, (anonymous namespace)::CGUseList&, (anonymous namespace)::CallGraphSCC&, mlir::MLIRContext*) + 3264
11 mlir-opt 0x0000000103ad3c18 (anonymous namespace)::InlinerPass::runOnOperation() + 1240
12 mlir-opt 0x0000000103ab7384 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) + 420
13 mlir-opt 0x0000000103ab78b4 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) + 320
14 mlir-opt 0x0000000103ab9230 mlir::PassManager::run(mlir::Operation*) + 1148
15 mlir-opt 0x0000000103ab26e8 performActions(llvm::raw_ostream&, bool, bool, std::__1::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, bool, bool) + 504
16 mlir-opt 0x0000000103ab22b8 mlir::LogicalResult llvm::function_ref<mlir::LogicalResult (std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::callback_fn<mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, bool, bool, bool, bool, bool, bool, bool)::$_0>(long, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) + 704
17 mlir-opt 0x0000000103b1d834 mlir::splitAndProcessBuffer(std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, bool, bool) + 656
18 mlir-opt 0x0000000103ab06e0 mlir::MlirOptMain(llvm::raw_ostream&, std::__1::unique_ptr<llvm::MemoryBuffer, std::__1::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, bool, bool, bool, bool, bool, bool, bool) + 216
19 mlir-opt 0x0000000103ab0bd4 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) + 1208
20 mlir-opt 0x00000001027337a4 main + 108
21 dyld 0x000000010707d088 start + 516
@llvm/issue-subscribers-mlir
https://reviews.llvm.org/D141901 will fix it.
@llvm/issue-subscribers-mlir-llvm