Issue 119863
Summary [mlir] -ownership-based-buffer-deallocation crashes
Labels mlir
Assignees
Reporter wwy6191
    git version: bc29fc937c6cb4a210f80c93c79fc6ed97c801f8

system: `Ubuntu 18.04.6 LTS`

reproduce with: `mlir-opt  -ownership-based-buffer-deallocation a.mlir`


a.mlir:  
``` 
func.func @simple_std_2_for(%arg0: f32) -> f32 {
  cf.br ^bb1

^bb1:
  %c = arith.constant 1: index
  %c0 = arith.constant 0: index
  %c1 = arith.constant 1: index
  %c10 = arith.constant 10: index
  %1 = scf.for %arg1 = %c0 to %c10 step %c1 iter_args(%arg2 = %arg0) -> f32 {
    %2 = arith.addf %arg2, %arg2 : f32
 scf.yield %2 : f32
  }
  cf.br ^bb2

^bb2:
  return %1 : f32
}

``` 
stack trace:

``` 
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt -ownership-based-buffer-deallocation /data/szy/MLIR/seed/seed0/tmp.3DSEn0mx34.mlir
 #0 0x0000555a76805348 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x111f348)
 #1 0x0000555a76802e5e llvm::sys::RunSignalHandlers() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x111ce5e)
 #2 0x0000555a76805cdd SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f33e62e8420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x0000555a76d0c7c9 mlir::bufferization::DeallocationState::getMemrefsToRetain(mlir::Block*, mlir::Block*, mlir::ValueRange, llvm::SmallVectorImpl<mlir::Value>&) const (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x16267c9)
 #5 0x0000555a76d9763a llvm::FailureOr<mlir::Operation*> (anonymous namespace)::BufferDeallocation::handleOp<mlir::MemoryEffectOpInterface, mlir::RegionBranchOpInterface, mlir::CallOpInterface, mlir::BranchOpInterface, mlir::RegionBranchTerminatorOpInterface>(mlir::Operation*) OwnershipBasedBufferDeallocation.cpp:0:0
 #6 0x0000555a76d95977 mlir::WalkResult llvm::function_ref<mlir::WalkResult (mlir::Block*)>::callback_fn<(anonymous namespace)::BufferDeallocation::deallocate(mlir::FunctionOpInterface)::$_0>(long, mlir::Block*) OwnershipBasedBufferDeallocation.cpp:0:0
 #7 0x0000555a76d93602 mlir::WalkResult mlir::detail::walk<mlir::ForwardDominanceIterator<false>>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Block*)>, mlir::WalkOrder) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x16ad602)
 #8 0x0000555a76d92691 mlir::bufferization::deallocateBuffersOwnershipBased(mlir::FunctionOpInterface, mlir::bufferization::DeallocationOptions) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x16ac691)
 #9 0x0000555a76d9a851 mlir::WalkResult llvm::function_ref<mlir::WalkResult (mlir::Operation*)>::callback_fn<std::enable_if<!llvm::is_one_of<mlir::func::FuncOp, mlir::Operation*, mlir::Region*, mlir::Block*>::value && std::is_same<mlir::WalkResult, mlir::WalkResult>::value, mlir::WalkResult>::type mlir::detail::walk<(mlir::WalkOrder)1, mlir::ForwardIterator, (anonymous namespace)::OwnershipBasedBufferDeallocationPass::runOnOperation()::'lambda'(mlir::func::FuncOp), mlir::func::FuncOp, mlir::WalkResult>(mlir::Operation*, (anonymous namespace)::OwnershipBasedBufferDeallocationPass::runOnOperation()::'lambda'(mlir::func::FuncOp)&&)::'lambda'(mlir::Operation*)>(long, mlir::Operation*) OwnershipBasedBufferDeallocation.cpp:0:0
#10 0x0000555a76931067 mlir::WalkResult mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Operation*)>, mlir::WalkOrder) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x124b067)
#11 0x0000555a76d9a61b (anonymous namespace)::OwnershipBasedBufferDeallocationPass::runOnOperation() OwnershipBasedBufferDeallocation.cpp:0:0
#12 0x0000555a797103d6 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x402a3d6)
#13 0x0000555a79710d00 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x402ad00)
#14 0x0000555a797132d2 mlir::PassManager::run(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x402d2d2)
#15 0x0000555a7970ba4a performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#16 0x0000555a7970b69d 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
#17 0x0000555a797b7235 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) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x40d1235)
#18 0x0000555a79705685 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x401f685)
#19 0x0000555a7970592f mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x401f92f)
#20 0x0000555a79705c5e mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x401fc5e)
#21 0x0000555a767e5e37 main (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10ffe37)
#22 0x00007f33e5906083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#23 0x0000555a767e59ae _start (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x10ff9ae)
``` 
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to