[mlir](test-ir-visitors) mlir-opt crashes with test-ir-visitors.
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
git version: 42f2cd0c980cc1a924619ecaeaa51ca7b55164ab
MLIR Program:
```mlir
module {
func.func private @m1() {
%cst = arith.constant 1.000000e+00 : f16
%cst_0 = arith.constant 5.600000e+03 : f16
%0 = spirv.CL.ceil %cst_0 : f16
%1 = spirv.Unordered %0, %cst_0 : f16
cf.br ^bb1(%1 : i1)
^bb1(%2: i1): // pred: ^bb0
%3 = memref.alloca_scope -> (f16) {
memref.alloca_scope.return %cst : f16
}
return
}
}
```
Reproduce Command: `mlir-opt -test-ir-visitors a.mlir`
StackTrace:
```
Erasing block ^bb0 from region 0 from operation 'func.func'
a.mlir:3:12: error: 'arith.constant' op operation destroyed but still has uses
%cst = arith.constant 1.000000e+00 : f16
^
a.mlir:3:12: note: see current operation: %0 = "arith.constant"() <{value = 1.000000e+00 : f16}> : () -> f16
a.mlir:10:7: note: - use: "memref.alloca_scope.return"(<>) : (f16) -> ()
memref.alloca_scope.return %cst : f16
^
LLVM ERROR: operation destroyed but still has uses
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: mlir-opt -test-ir-visitors a.mlir
#0 0x00005632c8099aff llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x20adaff)
#1 0x00005632c809665c llvm::sys::RunSignalHandlers() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x20aa65c)
#2 0x00005632c8096803 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007fea5eaec420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007fea5e5d700b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#5 0x00007fea5e5b6859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#6 0x00005632c7ff6705 (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x200a705)
#7 0x00005632c8076d55 (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x208ad55)
#8 0x00005632d196b7be mlir::Operation::~Operation() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb97f7be)
#9 0x00005632d196b883 llvm::ilist_traits::deleteNode(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb97f883)
#10 0x00005632d1893ba3 mlir::Block::~Block() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb8a7ba3)
#11 0x00005632d1894141 mlir::Block::erase() (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb8a8141)
#12 0x00005632c89eda83 void llvm::function_ref::callback_fn(long, mlir::Block*) TestVisitors.cpp:0:0
#13 0x00005632c89eca2f void mlir::detail::walk(mlir::Operation*, llvm::function_ref, mlir::WalkOrder) (.constprop.3) TestVisitors.cpp:0:0
#14 0x00005632c89ede6f testNoSkipErasureCallbacks(mlir::Operation*) TestVisitors.cpp:0:0
#15 0x00005632c89f8841 (anonymous namespace)::TestIRVisitorsPass::runOnOperation() TestVisitors.cpp:0:0
#16 0x00005632d15dbf81 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb5eff81)
#17 0x00005632d15dc310 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+0xb5f0310)
#18 0x00005632d15de3c4 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb5f23c4)
#19 0x00005632d15df491 mlir::PassManager::run(mlir::Operation*) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0xb5f3491)
#20 0x00005632c815ff7b performActions(llvm::raw_ostream&, std::shared_ptr const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#21 0x00005632c8160abf processBuffer(llvm::raw_ostream&, std::unique_ptr>, llvm::MemoryBufferRef, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, mlir::SourceMgrDiagnosticVerifierHandler*, llvm::ThreadPoolInterface*) MlirOptMain.cpp:0:0
#22 0x00005632c8160ceb 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
#23 0x00005632d19c3e55 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+0xb9d7e55)
#24 0x00005632c8156d34 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (.part.0) MlirOptMain.cpp:0:0
#25 0x00005632c8161207 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2175207)
#26 0x00005632c8161443 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x2175443)
#27 0x00005632c80009e7 main (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x20149e7)
#28 0x00007fea5e5b8083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#29 0x00005632c807648e _start (/data2/dependency/dev/llvm-project/build/bin/mlir-opt+0x208a48e)
Aborted (core dumped)
```
Contributor guide
Research direction
Reproduce the crash with `mlir-opt -test-ir-visitors a.mlir` using the supplied MLIR. Start in `TestVisitors.cpp`, especially `testNoSkipErasureCallbacks`, and trace the block erasure shown in the stack trace. Done means this input no longer aborts with a destroyed operation that still has uses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100