Issue 128314
Summary [MLIR]`-test-ir-visitors` triggers LLVM ERROR: operation destroyed but still has uses
Labels mlir
Assignees
Reporter xisang0
    Test on commit: https://github.com/llvm/llvm-project/commit/a9882bda96228ca23e166a817f93a7dbc99763cb
steps to reproduce:
```
mlir-opt test.mlir -test-ir-visitors
```
test case:
```
module {
  func.func @test_broadcast19(%arg0: tensor<64x64x1xf32> {bufferization.access = "read"}, %arg1: tensor<1x17xf32> {bufferization.access = "read"}) -> tensor<64x64x17xf32> {
    %0 = tosa.sub %arg0, %arg1 {__inplace_operands_attr__ = ["false", "false"]} : (tensor<64x64x1xf32>, tensor<1x17xf32>) -> tensor<64x64x17xf32>
    return {__inplace_operands_attr__ = ["true"]} %0 : tensor<64x64x17xf32>
  }
  func.func @main(%arg0: tensor<64x64x1xf32> {bufferization.access = "read"}, %arg1: tensor<1x17xf32> {bufferization.access = "read"}, %cond : i1) -> (tensor<64x64x17xf32>) {
 %0 = call @test_broadcast19(%arg0, %arg1) {__inplace_operands_attr__ = ["true", "true"]} : (tensor<64x64x1xf32>, tensor<1x17xf32>) -> tensor<64x64x17xf32>
    cf.cond_br %cond, ^bb_true, ^bb_false
 ^bb_true: // True branch
      // Here we could further process with results or call an operation
      return {__inplace_operands_attr__ = ["true"]} %0 : tensor<64x64x17xf32>

    ^bb_false: // False branch
      return {__inplace_operands_attr__ = ["true"]} %0 : tensor<64x64x17xf32>
 }
}
```
crash trace:
```
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-ir-visitors
 #0 0x000060354a23c998 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./mlir-opt+0x108a998)
 #1 0x000060354a23a4be llvm::sys::RunSignalHandlers() (./mlir-opt+0x10884be)
 #2 0x000060354a23d3a8 SignalHandler(int) Signals.cpp:0:0
 #3 0x000077f0317cb520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000077f03181f9fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x000077f0317cb476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x000077f0317b17f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x000060354a25c91c llvm::report_fatal_error(llvm::Twine const&, bool) (./mlir-opt+0x10aa91c)
 #8 0x000060354a25c766 (./mlir-opt+0x10aa766)
 #9 0x000060354d6ab82d mlir::Operation::~Operation() (./mlir-opt+0x44f982d)
#10 0x000060354d6ac43d llvm::ilist_traits<mlir::Operation>::deleteNode(mlir::Operation*) (./mlir-opt+0x44fa43d)
#11 0x000060354d5ec1c8 mlir::Block::~Block() (./mlir-opt+0x443a1c8)
#12 0x000060354d5ec69d mlir::Block::erase() (./mlir-opt+0x443a69d)
#13 0x000060354cba9b2e void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Block*)>, mlir::WalkOrder) (./mlir-opt+0x39f7b2e)
#14 0x000060354cba9b13 void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Block*)>, mlir::WalkOrder) (./mlir-opt+0x39f7b13)
#15 0x000060354d3f90c9 (anonymous namespace)::TestIRVisitorsPass::runOnOperation() TestVisitors.cpp:0:0
#16 0x000060354d50d3bf mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./mlir-opt+0x435b3bf)
#17 0x000060354d50dba2 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./mlir-opt+0x435bba2)
#18 0x000060354d51034e mlir::PassManager::run(mlir::Operation*) (./mlir-opt+0x435e34e)
#19 0x000060354d508e6b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#20 0x000060354d508acb 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 0x000060354d5b1df5 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+0x43ffdf5)
#22 0x000060354d5039b2 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./mlir-opt+0x43519b2)
#23 0x000060354d503c63 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x4351c63)
#24 0x000060354d503e72 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x4351e72)
#25 0x000060354a21bc27 main (./mlir-opt+0x1069c27)
#26 0x000077f0317b2d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#27 0x000077f0317b2e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#28 0x000060354a21b795 _start (./mlir-opt+0x1069795)
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