| Issue |
239615
|
| Summary |
[MLIR]Segmentation fault in test type conversion driver during dynamic legality checking
|
| Labels |
mlir
|
| Assignees |
|
| Reporter |
frida-albrecht
|
The `--test-legalize-patterns` pass crashes with a segmentation fault when running type conversion with pattern rollback disabled and folding performed before pattern application.
test commit: [4fb8315](https://github.com/llvm/llvm-project/commit/4fb83151289b8c9f5255d7e899d11ea94374c394)
test case:
```mlir
module {
func.func @main(%arg0: i16) -> i44 {
%0 = arith.extui %arg0 : i16 to i44
return %0 : i44
}
}
```
Step to reproduce:
```
mlir-opt test.mlir --test-legalize-patterns=test-legalize-folding-mode=before-patterns --test-legalize-type-conversion=allow-pattern-rollback=0
```
Crash backtrace:
```
notifyBlockInserted into func.func: was unlinked
notifyOperationInserted: arith.extui, was linked, exact position unknown
notifyOperationInserted: func.return, was linked, exact position unknown
notifyOperationModified: arith.extui
notifyBlockErased
notifyOperationModified: func.func
notifyOperationInserted: test.cast, was unlinked
notifyOperationReplaced: builtin.unrealized_conversion_cast
notifyOperationModified: arith.extui
notifyOperationErased: builtin.unrealized_conversion_cast
test.mlir:4:5: remark: op 'func.return' is not legalizable
return %0 : i44
^
test.mlir:4:5: note: see current operation: func.return %1 : i44
test.mlir:3:10: remark: op 'arith.extui' is not legalizable
%0 = arith.extui %arg0 : i16 to i44
^
test.mlir:3:10: note: see current operation: %1 = arith.extui %0 : i16 to i44
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /home/llvm-project/llvm-project-latest/build/bin/mlir-opt test.mlir --test-legalize-patterns=test-legalize-folding-mode=before-patterns --test-legalize-type-conversion=allow-pattern-rollback=0
#0 0x000055da048b4139 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fdb139)
#1 0x000055da048b093c llvm::sys::RunSignalHandlers() (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fd793c)
#2 0x000055da048b0aa6 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007f387b037520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000055da04ae3e21 std::_Function_handler<std::optional<bool> (mlir::Operation*), std::enable_if<!is_invocable_v<(anonymous namespace)::TestTypeConversionDriver::runOnOperation()::'lambda9'(test::TestCastOp), mlir::Operation*>, void>::type mlir::ConversionTarget::addDynamicallyLegalOp<test::TestCastOp, (anonymous namespace)::TestTypeConversionDriver::runOnOperation()::'lambda9'(test::TestCastOp)>((anonymous namespace)::TestTypeConversionDriver::runOnOperation()::'lambda9'(test::TestCastOp)&&)::'lambda'(mlir::Operation*)>::_M_invoke(std::_Any_data const&, mlir::Operation*&&) TestPatterns.cpp:0:0
#5 0x000055da0cfec75f mlir::ConversionTarget::isLegal(mlir::Operation*) const (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa71375f)
#6 0x000055da0d00b82b mlir::WalkResult mlir::detail::walk<mlir::ForwardDominanceIterator<false>>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Operation*)>, mlir::WalkOrder) (.constprop.0) DialectConversion.cpp:0:0
#7 0x000055da0d00ba1b mlir::WalkResult mlir::detail::walk<mlir::ForwardDominanceIterator<false>>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Operation*)>, mlir::WalkOrder) (.constprop.0) DialectConversion.cpp:0:0
#8 0x000055da0d00ba1b mlir::WalkResult mlir::detail::walk<mlir::ForwardDominanceIterator<false>>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Operation*)>, mlir::WalkOrder) (.constprop.0) DialectConversion.cpp:0:0
#9 0x000055da0d00be12 mlir::OperationConverter::applyConversion(llvm::ArrayRef<mlir::Operation*>) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa732e12)
#10 0x000055da0d00d48f applyConversion(llvm::ArrayRef<mlir::Operation*>, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig, (anonymous namespace)::OpConversionMode) DialectConversion.cpp:0:0
#11 0x000055da0d00d646 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, mlir::ConversionConfig) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa734646)
#12 0x000055da04b067a7 (anonymous namespace)::TestTypeConversionDriver::runOnOperation() TestPatterns.cpp:0:0
#13 0x000055da0d0bd3b9 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7e43b9)
#14 0x000055da0d0bd694 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7e4694)
#15 0x000055da0d0bf2e2 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7e62e2)
#16 0x000055da0d0c02b9 mlir::PassManager::run(mlir::Operation*) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xa7e72b9)
#17 0x000055da0497e696 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#18 0x000055da0497fc4e processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#19 0x000055da0497fe91 llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, 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::MemoryBufferRef, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#20 0x000055da0d4334cd 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::MemoryBufferRef const&, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0xab5a4cd)
#21 0x000055da04979b8a mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (.part.0) MlirOptMain.cpp:0:0
#22 0x000055da049804d1 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x20a74d1)
#23 0x000055da04980724 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x20a7724)
#24 0x000055da04855d5c main (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1f7cd5c)
#25 0x00007f387b01ed90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#26 0x00007f387b01ee40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#27 0x000055da048939d5 _start (/home/llvm-project/llvm-project-latest/build/bin/mlir-opt+0x1fba9d5)
Segmentation fault (core dumped)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs