Issue 132162
Summary [MLIR] `-eliminate-empty-tensors` triggers Assertion `!returnOps.empty() && "expected at least one ReturnOp"' failed.
Labels mlir
Assignees
Reporter Lambor24
    Test on commit: [6003c30](https://github.com/llvm/llvm-project/commit/6003c3055a4630be31cc3d459cdbb88248a007b9). 

steps to reproduce:

 ```
mlir-opt test.mlir -eliminate-empty-tensors
```

test case:

```
module {
  func.func @main() {
    spirv.Return
  }
}
```

crash trace:

```
mlir-opt: /home/projects/project/llvm-project/mlir/lib/Dialect/Bufferization/Transforms/OneShotModuleBufferize.cpp:137: LogicalResult (anonymous namespace)::aliasingFuncOpBBArgsAnalysis(FuncOp, OneShotAnalysisState &, FuncAnalysisState &): Assertion `!returnOps.empty() && "expected at least one ReturnOp"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /home/projects/project/llvm-project/build/bin/mlir-opt ./test.mlir -eliminate-empty-tensors
 #0 0x00005fdb67354ead llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/projects/project/llvm-project/llvm/lib/Support/Unix/Signals.inc:804:11
 #1 0x00005fdb6735539b PrintStackTraceSignalHandler(void*) /home/projects/project/llvm-project/llvm/lib/Support/Unix/Signals.inc:880:1
 #2 0x00005fdb67353406 llvm::sys::RunSignalHandlers() /home/projects/project/llvm-project/llvm/lib/Support/Signals.cpp:105:5
 #3 0x00005fdb67355b7d SignalHandler(int, siginfo_t*, void*) /home/projects/project/llvm-project/llvm/lib/Support/Unix/Signals.inc:418:7
 #4 0x0000791674580520 (/usr/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #5 0x00007916745d49fc pthread_kill (/usr/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #6 0x0000791674580476 gsignal (/usr/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #7 0x00007916745667f3 abort (/usr/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #8 0x000079167456671b (/usr/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #9 0x0000791674577e96 (/usr/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#10 0x00005fdb67e2f2fe (anonymous namespace)::aliasingFuncOpBBArgsAnalysis(mlir::func::FuncOp, mlir::bufferization::OneShotAnalysisState&, mlir::bufferization::func_ext::FuncAnalysisState&) /home/projects/project/llvm-project/mlir/lib/Dialect/Bufferization/Transforms/OneShotModuleBufferize.cpp:140:37
#11 0x00005fdb67e2ea35 mlir::bufferization::analyzeModuleOp(mlir::ModuleOp, mlir::bufferization::OneShotAnalysisState&, mlir::bufferization::BufferizationStatistics*) /home/projects/project/llvm-project/mlir/lib/Dialect/Bufferization/Transforms/OneShotModuleBufferize.cpp:472:16
#12 0x00005fdb67e0102c mlir::bufferization::eliminateEmptyTensors(mlir::RewriterBase&, mlir::Operation*) /home/projects/project/llvm-project/mlir/lib/Dialect/Bufferization/Transforms/EmptyTensorElimination.cpp:213:16
#13 0x00005fdb67e01586 (anonymous namespace)::EmptyTensorElimination::runOnOperation() /home/projects/project/llvm-project/mlir/lib/Dialect/Bufferization/Transforms/EmptyTensorElimination.cpp:227:14
#14 0x00005fdb6c9fa3cb mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int)::$_1::operator()() const /home/projects/project/llvm-project/mlir/lib/Pass/Pass.cpp:0:17
#15 0x00005fdb6c9fa365 void llvm::function_ref<void ()>::callback_fn<mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int)::$_1>(long) /home/projects/project/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:46:5
#16 0x00005fdb6737b209 llvm::function_ref<void ()>::operator()() const /home/projects/project/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:69:5
#17 0x00005fdb6c9fdfc5 void mlir::MLIRContext::executeAction<mlir::PassExecutionAction, mlir::Pass&>(llvm::function_ref<void ()>, llvm::ArrayRef<mlir::IRUnit>, mlir::Pass&) /home/projects/project/llvm-project/mlir/include/mlir/IR/MLIRContext.h:289:3
#18 0x00005fdb6c9f5c3a mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) /home/projects/project/llvm-project/mlir/lib/Pass/Pass.cpp:532:17
#19 0x00005fdb6c9f61c4 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) /home/projects/project/llvm-project/mlir/lib/Pass/Pass.cpp:592:16
#20 0x00005fdb6c9f7c28 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) /home/projects/project/llvm-project/mlir/lib/Pass/Pass.cpp:905:10
#21 0x00005fdb6c9f7b52 mlir::PassManager::run(mlir::Operation*) /home/projects/project/llvm-project/mlir/lib/Pass/Pass.cpp:885:60
#22 0x00005fdb6c9e8baa performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) /home/projects/project/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:474:17
#23 0x00005fdb6c9e876c processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, llvm::ThreadPoolInterface*) /home/projects/project/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:542:12
#24 0x00005fdb6c9e851c mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_0::operator()(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) const /home/projects/project/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:625:12
#25 0x00005fdb6c9e84b6 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&) /home/projects/project/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:46:12
#26 0x00005fdb6cb786a2 llvm::function_ref<llvm::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>::operator()(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) const /home/projects/project/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:69:12
#27 0x00005fdb6cb77c8c 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) /home/projects/project/llvm-project/mlir/lib/Support/ToolUtilities.cpp:27:12
#28 0x00005fdb6c9e4928 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) /home/projects/project/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:628:10
#29 0x00005fdb6c9e4ce9 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) /home/projects/project/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:669:14
#30 0x00005fdb6c9e4eb8 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) /home/projects/project/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:685:10
#31 0x00005fdb672c5a0c main /home/projects/project/llvm-project/mlir/tools/mlir-opt/mlir-opt.cpp:331:33
#32 0x0000791674567d90 (/usr/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#33 0x0000791674567e40 __libc_start_main (/usr/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#34 0x00005fdb672c5605 _start (/home/projects/project/llvm-project/build/bin/mlir-opt+0x29fe605)
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