Issue 128310
Summary [MLIR]`-test-extract-fixed-outer-loops` triggers Assertion Failure `!empty()'
Labels mlir
Assignees
Reporter xisang0
    Test on commit: https://github.com/llvm/llvm-project/commit/47928ab16b675c17826ada16f23aa0569e93a474
steps to reproduce:
```
mlir-opt test.mlir -test-extract-fixed-outer-loops
```
test case:
```
module {
  func.func @buffer_loop_hoisting(%lb: index, %ub: index, %step: index, %f: f32, %pos: index) {
    scf.for %iv = %lb to %ub step %step {
      %0 = memref.alloca() : memref<5xf32>
      memref.store %f, %0[%pos] : memref<5xf32>
    }
    return
  }
}
```
crash trace:
```
mlir-opt: /home/workdir/llvm-project-19/llvm/include/llvm/ADT/SmallVector.h:309: reference llvm::SmallVectorTemplateCommon<mlir::scf::ForOp>::back() [T = mlir::scf::ForOp]: Assertion `!empty()' failed.
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-extract-fixed-outer-loops
 #0 0x000058b7e127e9b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./mlir-opt+0x107f9b8)
 #1 0x000058b7e127c4de llvm::sys::RunSignalHandlers() (./mlir-opt+0x107d4de)
 #2 0x000058b7e127f3c8 SignalHandler(int) Signals.cpp:0:0
 #3 0x0000782a79522520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x0000782a795769fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x0000782a79522476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x0000782a795087f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x0000782a7950871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x0000782a79519e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x000058b7e30ca71a mlir::extractFixedOuterLoops(mlir::scf::ForOp, llvm::ArrayRef<long>) (./mlir-opt+0x2ecb71a)
#10 0x000058b7e3fcf6e5 void llvm::function_ref<void (mlir::Operation*)>::callback_fn<std::enable_if<!llvm::is_one_of<mlir::scf::ForOp, mlir::Operation*, mlir::Region*, mlir::Block*>::value && std::is_same<void, void>::value, void>::type mlir::detail::walk<(mlir::WalkOrder)1, mlir::ForwardIterator, (anonymous namespace)::SimpleParametricLoopTilingPass::runOnOperation()::'lambda'(mlir::scf::ForOp), mlir::scf::ForOp, void>(mlir::Operation*, (anonymous namespace)::SimpleParametricLoopTilingPass::runOnOperation()::'lambda'(mlir::scf::ForOp)&&)::'lambda'(mlir::Operation*)>(long, mlir::Operation*) TestLoopParametricTiling.cpp:0:0
#11 0x000058b7e1390a2e void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (./mlir-opt+0x1191a2e)
#12 0x000058b7e1390a2e void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (./mlir-opt+0x1191a2e)
#13 0x000058b7e3fcf50d (anonymous namespace)::SimpleParametricLoopTilingPass::runOnOperation() TestLoopParametricTiling.cpp:0:0
#14 0x000058b7e453808f mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./mlir-opt+0x433908f)
#15 0x000058b7e4538872 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./mlir-opt+0x4339872)
#16 0x000058b7e453b01e mlir::PassManager::run(mlir::Operation*) (./mlir-opt+0x433c01e)
#17 0x000058b7e4533b3b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#18 0x000058b7e453379b 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
#19 0x000058b7e45ddf25 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)
#20 0x000058b7e452e682 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./mlir-opt+0x432f682)
#21 0x000058b7e452e933 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x432f933)
#22 0x000058b7e452eb42 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x432fb42)
#23 0x000058b7e125dbd7 main (./mlir-opt+0x105ebd7)
#24 0x0000782a79509d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#25 0x0000782a79509e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#26 0x000058b7e125d745 _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