llvm-project
llvm-project copied to clipboard
[mlir] Convert-spirv-to-llvm Pass triggers Assertion Failure "op region should not be empty!"
MLIR built at commit https://github.com/llvm/llvm-project/commit/a5ddd920 Reproduced with:
mlir-opt --convert-spirv-to-llvm temp.mlir
temp.mlir:
func.func @func() {
spirv.mlir.loop {
}
return
}
trace:
Assertion failed: (!getBody().empty() && "op region should not be empty!"), function getEntryBlock, file SPIRVOps.cpp, line 3287.
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 --convert-spirv-to-llvm 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 0x000000010235c5bc llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 mlir-opt 0x000000010235b624 llvm::sys::RunSignalHandlers() + 112
2 mlir-opt 0x000000010235cc54 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 libsystem_c.dylib 0x00000001a55ab754 err + 0
7 mlir-opt 0x0000000103b21c0c mlir::spirv::LoopOp::getEntryBlock() (.cold.3) + 0
8 mlir-opt 0x0000000102e29300 mlir::spirv::LoopOp::getEntryBlock() + 96
9 mlir-opt 0x000000010329dae8 (anonymous namespace)::LoopPattern::matchAndRewrite(mlir::spirv::LoopOp, mlir::spirv::LoopOpAdaptor, mlir::ConversionPatternRewriter&) const + 116
10 mlir-opt 0x000000010329da18 mlir::OpConversionPattern<mlir::spirv::LoopOp>::matchAndRewrite(mlir::Operation*, llvm::ArrayRef<mlir::Value>, mlir::ConversionPatternRewriter&) const + 144
11 mlir-opt 0x000000010359ee34 mlir::ConversionPattern::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const + 200
12 mlir-opt 0x00000001037fbbd0 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<mlir::LogicalResult (mlir::Pattern const&)>) + 1440
13 mlir-opt 0x00000001035a94b0 (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) + 1948
14 mlir-opt 0x00000001035a2b1c (anonymous namespace)::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>, llvm::function_ref<void (mlir::Diagnostic&)>) + 928
15 mlir-opt 0x00000001035a4d18 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void>>*) + 80
16 mlir-opt 0x00000001032adc20 (anonymous namespace)::ConvertSPIRVToLLVMPass::runOnOperation() + 600
17 mlir-opt 0x00000001035674dc mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) + 420
18 mlir-opt 0x0000000103567a0c mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) + 320
19 mlir-opt 0x0000000103569388 mlir::PassManager::run(mlir::Operation*) + 1148
20 mlir-opt 0x0000000103562840 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
21 mlir-opt 0x0000000103562410 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
22 mlir-opt 0x00000001035cd02c 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
23 mlir-opt 0x0000000103560838 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
24 mlir-opt 0x0000000103560d2c mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) + 1208
25 mlir-opt 0x00000001021ff0a0 main + 108
26 dyld 0x0000000106c4d088 start + 516
@llvm/issue-subscribers-mlir-spirv
I confirmed that this crash is fixed by #113527.