[mlir](canonicalize) mlir-opt crashes at PatternMatch.cpp:156 with assertion `op->use_empty() && "expected 'op' to have no uses"' failed.
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
git version: 2e87cf8c2b8ec6453ccfa7e448d5b33f1d71a2ca
MLIR Program:
```mlir
module {
test.graph_region {
%0 = builtin.unrealized_conversion_cast %0 : i32 to i32
"test.return"() : () -> ()
}
}
```
Reproduce Command: `mlir-opt -canonicalize a.mlir`
StackTrace:
```
mlir-opt: /data2/dependency/dev/llvm-project/mlir/lib/IR/PatternMatch.cpp:156: virtual void mlir::RewriterBase::eraseOp(mlir::Operation*): Assertion `op->use_empty() && "expected 'op' to have no uses"' failed.
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: /data2/dependency/dev/llvm-project/build/bin/mlir-opt -canonicalize a.mlir
#0 0x0000561d98b9a1cf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25c71cf)
#1 0x0000561d98b9699c llvm::sys::RunSignalHandlers() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25c399c)
#2 0x0000561d98b96b37 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007f2c63e96420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007f2c6398100b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007f2c63960859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00007f2c63960729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#7 0x00007f2c63971fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#8 0x0000561da1d4d486 mlir::RewriterBase::eraseOp(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb77a486)
#9 0x0000561da1d4a5eb mlir::RewriterBase::replaceOp(mlir::Operation*, mlir::ValueRange) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb7775eb)
#10 0x0000561da1917b89 (anonymous namespace)::GreedyPatternRewriteDriver::processWorklist() GreedyPatternRewriteDriver.cpp:0:0
#11 0x0000561da191ae66 mlir::applyPatternsGreedily(mlir::Region&, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig, bool*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb347e66)
#12 0x0000561da18674d2 (anonymous namespace)::Canonicalizer::runOnOperation() Canonicalizer.cpp:0:0
#13 0x0000561da19b75e1 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3e45e1)
#14 0x0000561da19b7970 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3e4970)
#15 0x0000561da19b9a24 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3e6a24)
#16 0x0000561da19baab1 mlir::PassManager::run(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb3e7ab1)
#17 0x0000561d98c6022b performActions(llvm::raw_ostream&, std::shared_ptr const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#18 0x0000561d98c60cd3 processBuffer(llvm::raw_ostream&, std::unique_ptr>, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#19 0x0000561d98c60f5b llvm::LogicalResult llvm::function_ref>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>::callback_fn>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::'lambda'(std::unique_ptr>, llvm::MemoryBufferRef, llvm::raw_ostream&)>(long, std::unique_ptr>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#20 0x0000561da1d92535 mlir::splitAndProcessBuffer(std::unique_ptr>, llvm::function_ref>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb7bf535)
#21 0x0000561d98c57064 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (.part.0) MlirOptMain.cpp:0:0
#22 0x0000561d98c61477 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x268e477)
#23 0x0000561d98c616b3 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x268e6b3)
#24 0x0000561d98ac6b8c main (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x24f3b8c)
#25 0x00007f2c63962083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#26 0x0000561d98b768de _start (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x25a38de)
Aborted (core dumped)
```
Contributor guide
Assessment
This issue has not been assessed yet.