Closed

Description
git version: 3a3b84b
system: Ubuntu 20.04.6 LTS (Focal Fossa)
reproduced with: mlir-opt --fold-memref-alias-ops a.mlir
a.mlir
:
func.func @func2() {
%c0 = arith.constant 0 : index
%c16 = arith.constant 16 : index
%c23 = arith.constant 23 : index
%alloc = memref.alloc(%c23, %c16) {alignment = 64 : i64} : memref<?x?xi1>
%collapse_shape = memref.collapse_shape %alloc [[0, 1]] : memref<?x?xi1> into memref<?xi1>
%103 = memref.load %collapse_shape[%c0] : memref<?xi1>
vector.print %103 : i1
return
}
trace:
mlir-opt: /data/bin/llvm-project/mlir/lib/Dialect/Utils/IndexingUtils.cpp:73: llvm::SmallVector<long int> mlir::computeSuffixProduct(llvm::ArrayRef<long int>): Assertion `llvm::all_of(sizes, [](int64_t s) { return s > 0; }) && "sizes must be nonnegative"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /data/bin/llvm-project/build/bin/mlir-opt --fold-memref-alias-ops a.mlir
#0 0x0000563eaabda33f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/bin/llvm-project/build/bin/mlir-opt+0x159633f)
#1 0x0000563eaabd73d4 SignalHandler(int) Signals.cpp:0:0
#2 0x00007fb5a0e54420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x00007fb5a093f00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#4 0x00007fb5a091e859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#5 0x00007fb5a091e729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#6 0x00007fb5a092ffd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#7 0x0000563eaf89682e mlir::computeSuffixProduct(llvm::ArrayRef<long>) (/data/bin/llvm-project/build/bin/mlir-opt+0x625282e)
#8 0x0000563eabdf69ff resolveSourceIndicesCollapseShape(mlir::Location, mlir::PatternRewriter&, mlir::memref::CollapseShapeOp, mlir::ValueRange, llvm::SmallVectorImpl<mlir::Value>&) FoldMemRefAliasOps.cpp:0:0
#9 0x0000563eabe0683c (anonymous namespace)::LoadOpOfCollapseShapeOpFolder<mlir::memref::LoadOp>::matchAndRewrite(mlir::memref::LoadOp, mlir::PatternRewriter&) const FoldMemRefAliasOps.cpp:0:0
#10 0x0000563eb0326038 mlir::PatternApplicator::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&, llvm::function_ref<bool (mlir::Pattern const&)>, llvm::function_ref<void (mlir::Pattern const&)>, llvm::function_ref<mlir::LogicalResult (mlir::Pattern const&)>) (/data/bin/llvm-project/build/bin/mlir-opt+0x6ce2038)
#11 0x0000563ead71903c (anonymous namespace)::GreedyPatternRewriteDriver::processWorklist() GreedyPatternRewriteDriver.cpp:0:0
#12 0x0000563ead71d4ab mlir::applyPatternsAndFoldGreedily(mlir::Region&, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig, bool*) (/data/bin/llvm-project/build/bin/mlir-opt+0x40d94ab)
#13 0x0000563eabdfa43a (anonymous namespace)::FoldMemRefAliasOpsPass::runOnOperation() FoldMemRefAliasOps.cpp:0:0
#14 0x0000563ead661e1e mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x401de1e)
#15 0x0000563ead6622fa mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/bin/llvm-project/build/bin/mlir-opt+0x401e2fa)
#16 0x0000563ead662b24 mlir::PassManager::run(mlir::Operation*) (/data/bin/llvm-project/build/bin/mlir-opt+0x401eb24)
#17 0x0000563ead6533eb performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#18 0x0000563ead6548a4 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, llvm::ThreadPool*) MlirOptMain.cpp:0:0
#19 0x0000563ead654a54 mlir::LogicalResult llvm::function_ref<mlir::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&)::'lambda'(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#20 0x0000563ead752ce4 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, bool, bool) (/data/bin/llvm-project/build/bin/mlir-opt+0x410ece4)
#21 0x0000563ead64dd27 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/bin/llvm-project/build/bin/mlir-opt+0x4009d27)
#22 0x0000563ead654d7b mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x4010d7b)
#23 0x0000563eaab1323b main (/data/bin/llvm-project/build/bin/mlir-opt+0x14cf23b)
#24 0x00007fb5a0920083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#25 0x0000563eaabaaede _start (/data/bin/llvm-project/build/bin/mlir-opt+0x1566ede)
Aborted (core dumped)