Issue 128341
Summary [MLIR]`-remove-dead-values` triggers Segmentation fault (core dumped)
Labels mlir
Assignees
Reporter xisang0
    Test on commit: https://github.com/llvm/llvm-project/commit/1d070988d9172965dee227e5629fa886845b815f
step to reproduce:
```
mlir-opt test.mlir -remove-dead-values
```
test case:
```
module {
  func.func @main(%init_ndhwc: tensor<1x2x2x2x1xf32>) -> () {
    %0 = arith.constant 0.0 : f32
    %fill_ndhwc = linalg.fill ins(%0 : f32) outs(%init_ndhwc : tensor<1x2x2x2x1xf32>) -> tensor<1x2x2x2x1xf32>
    return
  }
}
```
crash trace:
```
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 -remove-dead-values
 #0 0x000064ed3293b2b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./mlir-opt+0x10b62b8)
 #1 0x000064ed32938dde llvm::sys::RunSignalHandlers() (./mlir-opt+0x10b3dde)
 #2 0x000064ed3293bcc8 SignalHandler(int) Signals.cpp:0:0
 #3 0x0000775352f05520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000064ed33318c04 llvm::detail::indexed_accessor_range_base<mlir::OperandRange, mlir::OpOperand*, mlir::Value, mlir::Value, mlir::Value>::iterator std::__find_if<llvm::detail::indexed_accessor_range_base<mlir::OperandRange, mlir::OpOperand*, mlir::Value, mlir::Value, mlir::Value>::iterator, __gnu_cxx::__ops::_Iter_pred<mlir::detail::DestinationStyleOpInterfaceTrait<mlir::linalg::FillOp>::hasPureTensorSemantics()::'lambda'(mlir::Value)>>(llvm::detail::indexed_accessor_range_base<mlir::OperandRange, mlir::OpOperand*, mlir::Value, mlir::Value, mlir::Value>::iterator, llvm::detail::indexed_accessor_range_base<mlir::OperandRange, mlir::OpOperand*, mlir::Value, mlir::Value, mlir::Value>::iterator, __gnu_cxx::__ops::_Iter_pred<mlir::detail::DestinationStyleOpInterfaceTrait<mlir::linalg::FillOp>::hasPureTensorSemantics()::'lambda'(mlir::Value)>, std::random_access_iterator_tag) (./mlir-opt+0x1a93c04)
 #5 0x000064ed33248f89 mlir::detail::DestinationStyleOpInterfaceTrait<mlir::linalg::FillOp>::hasPureTensorSemantics() (./mlir-opt+0x19c3f89)
 #6 0x000064ed33248ecf mlir::linalg::FillOp::getEffects(llvm::SmallVectorImpl<mlir::SideEffects::EffectInstance<mlir::MemoryEffects::Effect>>&) (./mlir-opt+0x19c3ecf)
 #7 0x000064ed334887a8 mlir::detail::MemoryEffectOpInterfaceInterfaceTraits::Model<mlir::linalg::FillOp>::getEffects(mlir::detail::MemoryEffectOpInterfaceInterfaceTraits::Concept const*, mlir::Operation*, llvm::SmallVectorImpl<mlir::SideEffects::EffectInstance<mlir::MemoryEffects::Effect>>&) (./mlir-opt+0x1c037a8)
 #8 0x000064ed37e6abb3 mlir::isMemoryEffectFree(mlir::Operation*) (./mlir-opt+0x65e5bb3)
 #9 0x000064ed35d65d44 void llvm::function_ref<void (mlir::Operation*)>::callback_fn<(anonymous namespace)::RemoveDeadValues::runOnOperation()::$_0>(long, mlir::Operation*) RemoveDeadValues.cpp:0:0
#10 0x000064ed32a4f0ae void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (./mlir-opt+0x11ca0ae)
#11 0x000064ed32a4f0ae void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (./mlir-opt+0x11ca0ae)
#12 0x000064ed35d64e67 (anonymous namespace)::RemoveDeadValues::runOnOperation() RemoveDeadValues.cpp:0:0
#13 0x000064ed35d3164f mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./mlir-opt+0x44ac64f)
#14 0x000064ed35d31dd2 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./mlir-opt+0x44acdd2)
#15 0x000064ed35d3455e mlir::PassManager::run(mlir::Operation*) (./mlir-opt+0x44af55e)
#16 0x000064ed35d2d0ab performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#17 0x000064ed35d2cd03 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
#18 0x000064ed35dd6465 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+0x4551465)
#19 0x000064ed35d26962 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./mlir-opt+0x44a1962)
#20 0x000064ed35d26c13 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x44a1c13)
#21 0x000064ed35d26e22 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x44a1e22)
#22 0x000064ed3291a4d7 main (./mlir-opt+0x10954d7)
#23 0x0000775352eecd90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#24 0x0000775352eece40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#25 0x000064ed3291a045 _start (./mlir-opt+0x1095045)
Segmentation fault (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