llvm-project
llvm-project copied to clipboard
[mlir] -buffer-hoisting crashes
git version: d09707070c7460d0887eae8f7022e816510d5eb1
system: Ubuntu 18.04.6 LTS
reproduce with: mlir-opt -buffer-hoisting a.mlir
a.mlir:
module {
func.func @f(%arg0: f32) {
%c0 = arith.constant 0 : index
return
^BB1(%0: i32): // no predecessors
%cst = arith.constant 1.000000e+00 : f32
%c0_0 = arith.constant 0 : index
%c10 = arith.constant 10 : index
%c1 = arith.constant 1 : index
%alloc = memref.alloc() : memref<10xf32>
%c0_1 = arith.constant 0 : index
%c10_2 = arith.constant 10 : index
%c1_3 = arith.constant 1 : index
cf.br ^BB2(%c0_1 : index)
^BB2(%1: index): // 2 preds: ^BB1, ^BB3
%2 = arith.cmpi slt, %1, %c10 : index
cf.cond_br %2, ^BB3(%1 : index), ^BB4
^BB3(%3: index): // 2 preds: ^BB2, ^BB5
%4 = arith.cmpi slt, %3, %c10 : index
cf.cond_br %4, ^BB4, ^BB6
^BB4: // pred: ^BB3
%5 = memref.load %alloc[%1] : memref<10xf32>
%6 = arith.addf %5, %cst : f32
memref.store %6, %alloc[%1] : memref<10xf32>
%7 = arith.addi %3, %c1 : index
cf.br ^BB5(%7 : index)
^BB5(%8: index): // 2 preds: ^BB4, ^BB5
%9 = arith.cmpi slt, %8, %c10 : index
cf.cond_br %9, ^BB6, ^BB7
^BB6: // pred: ^BB5
%10 = arith.addi %8, %c1 : index
cf.br ^BB5(%10 : index)
^BB7: // pred: ^BB6
return
}
}
stack trace:
mlir-opt: /data/szy/MLIR/llvm-release/llvm-project/llvm/include/llvm/Support/GenericDomTree.h:535: NodeT *llvm::DominatorTreeBase<mlir::Block, false>::findNearestCommonDominator(NodeT *, NodeT *) const [NodeT = mlir::Block, IsPostDom = false]: Assertion `NodeA && "A must be in the tree"' 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/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt -buffer-hoisting /data/szy/MLIR/seed/seed15/tmp.FeIsmb9dCg.mlir
#0 0x000055d6f9dd2f88 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1185f88)
#1 0x000055d6f9dd0a9e llvm::sys::RunSignalHandlers() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1183a9e)
#2 0x000055d6f9dd391d SignalHandler(int) Signals.cpp:0:0
#3 0x00007fab40550420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007fab3fb8d00b raise /build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#5 0x00007fab3fb6c859 abort /build/glibc-LcI20x/glibc-2.31/stdlib/abort.c:81:7
#6 0x00007fab3fb6c729 get_sysdep_segment_value /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:509:8
#7 0x00007fab3fb6c729 _nl_load_domain /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:970:34
#8 0x00007fab3fb7dfd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#9 0x000055d6fd35c25b llvm::DominatorTreeBase<mlir::Block, false>::findNearestCommonDominator(mlir::Block*, mlir::Block*) const (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x470f25b)
#10 0x000055d6fa33d3b9 mlir::Block* mlir::detail::DominanceInfoBase<false>::findNearestCommonDominator<llvm::SmallPtrSet<mlir::Block*, 16u>&>(llvm::SmallPtrSet<mlir::Block*, 16u>&) const (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x16f03b9)
#11 0x000055d6fa33cff9 mlir::Block* mlir::bufferization::findCommonDominator<mlir::DominanceInfo>(mlir::Value, llvm::SmallPtrSet<mlir::Value, 16u> const&, mlir::DominanceInfo const&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x16efff9)
#12 0x000055d6fa33d7fb (anonymous namespace)::BufferHoistingPass::runOnOperation() BufferOptimizations.cpp:0:0
#13 0x000055d6fd20d936 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x45c0936)
#14 0x000055d6fd20e260 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x45c1260)
#15 0x000055d6fd21360e auto void mlir::parallelForEach<__gnu_cxx::__normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0>(mlir::MLIRContext*, __gnu_cxx::__normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, __gnu_cxx::__normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>, mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::$_0&&)::'lambda'(__gnu_cxx::__normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>&&)::operator()<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo&>(__gnu_cxx::__normal_iterator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo*, std::vector<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo, std::allocator<mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool)::OpPMInfo>>>&&) const Pass.cpp:0:0
#16 0x000055d6fd20f8bb mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x45c28bb)
#17 0x000055d6fd20da8f mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x45c0a8f)
#18 0x000055d6fd20e260 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x45c1260)
#19 0x000055d6fd210832 mlir::PassManager::run(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x45c3832)
#20 0x000055d6fd2090da performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#21 0x000055d6fd208d2d 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
#22 0x000055d6fd2b4fa5 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) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x4667fa5)
#23 0x000055d6fd202d15 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x45b5d15)
#24 0x000055d6fd202fbf mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x45b5fbf)
#25 0x000055d6fd2032ee mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x45b62ee)
#26 0x000055d6f9db3a77 main (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1166a77)
#27 0x00007fab3fb6e083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#28 0x000055d6f9db35ee _start (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x11665ee)