Issue 128306
Summary [MLIR]`-test-transform-dialect-erase-schedule` triggers LLVM ERROR: operation destroyed but still has uses
Labels mlir
Assignees
Reporter xisang0
    Test on commit: https://github.com/llvm/llvm-project/commit/47928ab16b675c17826ada16f23aa0569e93a474
steps to reproduce:
```
mlir-opt test.mlir -test-transform-dialect-erase-schedule
```
test case:
```
module {
 func.func @main(%arg0: !transform.any_op) -> () {
    // First transformation block
    %match_result_0 = transform.structured.match ops{["tensor.unpack"]} in %arg0 : (!transform.any_op) -> !transform.any_op
    %match_result_1 = transform.structured.match ops{["linalg.fill"]} in %arg0 : (!transform.any_op) -> !transform.any_op
 %pack_result_0, %pack_result_1, %pack_result_2 = transform.structured.pack_transpose %match_result_0 with_compute_op(%match_result_1)
      inner_perm = [0] : (!transform.any_op, !transform.any_op)
      -> (!transform.any_op, !transform.any_op, !transform.any_op)
    return
  }
}
```
crash trace:
```
/home/workdir/test.mlir:4:23: error: 'transform.structured.match' op operation destroyed but still has uses
 %match_result_0 = transform.structured.match ops{["tensor.unpack"]} in %arg0 : (!transform.any_op) -> !transform.any_op
 ^
/home/workdir/test.mlir:4:23: note: see current operation: %0 = "transform.structured.match"(<<UNKNOWN SSA VALUE>>) <{ops = ["tensor.unpack"]}> : (!transform.any_op) -> !transform.any_op
/home/workdir/test.mlir:6:54: note: - use: %1:3 = "transform.structured.pack_transpose"(<<UNKNOWN SSA VALUE>>, %0) <{inner_perm = array<i64: 0>}> : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op, !transform.any_op)

 %pack_result_0, %pack_result_1, %pack_result_2 = transform.structured.pack_transpose %match_result_0 with_compute_op(%match_result_1)
 ^
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.
Stack dump:
0.      Program arguments: ./mlir-opt /home/workdir/test.mlir -test-transform-dialect-erase-schedule
 #0 0x000064440e3069b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./mlir-opt+0x107f9b8)
 #1 0x000064440e3044de llvm::sys::RunSignalHandlers() (./mlir-opt+0x107d4de)
 #2 0x000064440e3073c8 SignalHandler(int) Signals.cpp:0:0
 #3 0x000073760ce90520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000073760cee49fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x000073760ce90476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x000073760ce767f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x000064440e32693c llvm::report_fatal_error(llvm::Twine const&, bool) (./mlir-opt+0x109f93c)
 #8 0x000064440e326786 (./mlir-opt+0x109f786)
 #9 0x000064441175fd0d mlir::Operation::~Operation() (./mlir-opt+0x44d8d0d)
#10 0x0000644411767de2 llvm::iplist_impl<llvm::simple_ilist<mlir::Operation>, llvm::ilist_traits<mlir::Operation>>::erase(llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Operation, true, false, void, false, void>, false, false>) (./mlir-opt+0x44e0de2)
#11 0x0000644411555719 mlir::WalkResult llvm::function_ref<mlir::WalkResult (mlir::Operation*)>::callback_fn<(anonymous namespace)::TestTransformDialectEraseSchedulePass::runOnOperation()::'lambda'(mlir::Operation*)>(long, mlir::Operation*) TestTransformDialectInterpreter.cpp:0:0
#12 0x000064440e429e98 mlir::WalkResult mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Operation*)>, mlir::WalkOrder) (./mlir-opt+0x11a2e98)
#13 0x000064440e429e47 mlir::WalkResult mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Operation*)>, mlir::WalkOrder) (./mlir-opt+0x11a2e47)
#14 0x000064440e429e47 mlir::WalkResult mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Operation*)>, mlir::WalkOrder) (./mlir-opt+0x11a2e47)
#15 0x000064441155561c (anonymous namespace)::TestTransformDialectEraseSchedulePass::runOnOperation() TestTransformDialectInterpreter.cpp:0:0
#16 0x00006444115c008f mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./mlir-opt+0x433908f)
#17 0x00006444115c0872 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./mlir-opt+0x4339872)
#18 0x00006444115c301e mlir::PassManager::run(mlir::Operation*) (./mlir-opt+0x433c01e)
#19 0x00006444115bbb3b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#20 0x00006444115bb79b llvm::LogicalResult llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, 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&)::$_0>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#21 0x0000644411665f25 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::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (./mlir-opt+0x43def25)
#22 0x00006444115b6682 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./mlir-opt+0x432f682)
#23 0x00006444115b6933 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x432f933)
#24 0x00006444115b6b42 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x432fb42)
#25 0x000064440e2e5bd7 main (./mlir-opt+0x105ebd7)
#26 0x000073760ce77d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#27 0x000073760ce77e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#28 0x000064440e2e5745 _start (./mlir-opt+0x105e745)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to