| Issue |
64674
|
| Summary |
[mlir] --inline crashed with assertion failure "expected 'source' to have no successors"
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
anonymousMCS
|
git version: 0fb3066873fdfbe28dbb6409c58a8bff7cf208c6
system: Ubuntu 20.04.6 LTS (Focal Fossa)
reproduced with: `mlir-opt --inline a.mlir`
a.mlir:
```
func.func private @func1() {
%idx0 = index.constant 1
%alloc_20 = memref.alloc(%idx0, %idx0) : memref<?x?xi32>
scf.index_switch %idx0 -> f32
default {
%cst_11 = arith.constant 1.71053568E+9 : f32
memref.alloca_scope {
%alloc_21 = memref.alloc(%idx0, %idx0) : memref<?x?xi32>
memref.copy %alloc_20, %alloc_21 : memref<?x?xi32> to memref<?x?xi32>
func.call @__mlir_math_fpowi_f16_i32() : () -> ()
}
scf.yield %cst_11 : f32
}
return
}
func.func @func2() {
memref.alloca_scope {
%idx0 = index.constant 1
func.call @func1() : () -> ()
scf.index_switch %idx0 -> memref<?x25xi64>
default {
%alloc_18 = memref.alloc(%idx0) : memref<?x25xi64>
scf.yield %alloc_18 : memref<?x25xi64>
}
}
return
}
func.func private @__mlir_math_fpowi_f16_i32() attributes {llvm.linkage = #llvm.linkage<linkonce_odr>} {
%cst = arith.constant 1.000000e+00 : f16
%c0_i32 = arith.constant 1 : i32
cf.br ^bb3(%cst, %cst, %c0_i32 : f16, f16, i32)
^bb3(%6: f16, %7: f16, %8: i32):
cf.br ^bb5(%6 : f16)
^bb5(%12: f16):
%13 = arith.shrui %8, %c0_i32 : i32
cf.br ^bb3(%12, %12, %c0_i32 : f16, f16, i32)
}
```
trace:
```
mlir-opt: /data/bin/llvm-project/mlir/lib/IR/PatternMatch.cpp:351: virtual void mlir::RewriterBase::inlineBlockBefore(mlir::Block*, mlir::Block*, mlir::Block::iterator, mlir::ValueRange): Assertion `source->hasNoSuccessors() && "expected 'source' to have no successors"' 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 --inline a.mlir
#0 0x0000557b42ca3def llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/bin/llvm-project/build/bin/mlir-opt+0x14b0def)
#1 0x0000557b42ca1074 SignalHandler(int) Signals.cpp:0:0
#2 0x00007f06b8f86420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x00007f06b8a7100b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#4 0x00007f06b8a50859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#5 0x00007f06b8a50729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
#6 0x00007f06b8a61fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#7 0x0000557b457ab093 mlir::RewriterBase::inlineBlockBefore(mlir::Block*, mlir::Block*, llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Operation, true, false, void>, false, false>, mlir::ValueRange) (/data/bin/llvm-project/build/bin/mlir-opt+0x3fb8093)
#8 0x0000557b43dd9663 AllocaScopeInliner::matchAndRewrite(mlir::memref::AllocaScopeOp, mlir::PatternRewriter&) const (/data/bin/llvm-project/build/bin/mlir-opt+0x25e6663)
#9 0x0000557b481f3598 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+0x6a00598)
#10 0x0000557b45646657 (anonymous namespace)::GreedyPatternRewriteDriver::processWorklist() GreedyPatternRewriteDriver.cpp:0:0
#11 0x0000557b4564a89b mlir::applyPatternsAndFoldGreedily(mlir::Region&, mlir::FrozenRewritePatternSet const&, mlir::GreedyRewriteConfig, bool*) (/data/bin/llvm-project/build/bin/mlir-opt+0x3e5789b)
#12 0x0000557b455b8d8a (anonymous namespace)::Canonicalizer::runOnOperation() Canonicalizer.cpp:0:0
#13 0x0000557b45599d6e mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x3da6d6e)
#14 0x0000557b4559a24a 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+0x3da724a)
#15 0x0000557b4559b3db mlir::LogicalResult llvm::function_ref<mlir::LogicalResult (mlir::OpPassManager&, mlir::Operation*)>::callback_fn<mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int)::'lambda'(mlir::OpPassManager&, mlir::Operation*)>(long, mlir::OpPassManager&, mlir::Operation*) Pass.cpp:0:0
#16 0x0000557b455c8863 (anonymous namespace)::InlinerPass::optimizeCallable(mlir::CallGraphNode*, llvm::StringMap<mlir::OpPassManager, llvm::MallocAllocator>&) Inliner.cpp:0:0
#17 0x0000557b455d13b5 mlir::LogicalResult llvm::function_ref<mlir::LogicalResult ((anonymous namespace)::CallGraphSCC&)>::callback_fn<(anonymous namespace)::InlinerPass::runOnOperation()::'lambda'((anonymous namespace)::CallGraphSCC&)>(long, (anonymous namespace)::CallGraphSCC&) Inliner.cpp:0:0
#18 0x0000557b455d26c3 (anonymous namespace)::InlinerPass::runOnOperation() Inliner.cpp:0:0
#19 0x0000557b45599d6e mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x3da6d6e)
#20 0x0000557b4559a24a 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+0x3da724a)
#21 0x0000557b4559aa51 mlir::PassManager::run(mlir::Operation*) (/data/bin/llvm-project/build/bin/mlir-opt+0x3da7a51)
#22 0x0000557b4558aefb performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#23 0x0000557b4558c3b4 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
#24 0x0000557b4558c564 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
#25 0x0000557b45680154 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+0x3e8d154)
#26 0x0000557b45585987 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+0x3d92987)
#27 0x0000557b4558c88b mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x3d9988b)
#28 0x0000557b42bde0e3 main (/data/bin/llvm-project/build/bin/mlir-opt+0x13eb0e3)
#29 0x00007f06b8a52083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#30 0x0000557b42c7561e _start (/data/bin/llvm-project/build/bin/mlir-opt+0x148261e)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs