Open
Description
git version: 0f50330
system: Ubuntu 18.04.6 LTS
reproduce with: mlir-opt -lift-cf-to-scf a.mlir
a.mlir:
module {
func.func @optional_arg(%arg: i1) {
%c0 = arith.constant 0 :index
spirv.BranchConditional %arg, ^bb1, ^bb2
^bb1: // pred: ^bb0
spirv.Return
^bb2: // pred: ^bb0
spirv.Return
}
}
stack trace:
mlir-opt: /data/szy/MLIR/llvm-debug/llvm-project/mlir/include/mlir/IR/UseDefLists.h:198: mlir::IRObjectWithUseList<mlir::BlockOperand>::~IRObjectWithUseList() [OperandType = mlir::BlockOperand]: Assertion `use_empty() && "Cannot destroy a value that still has uses!"' 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-debug/llvm-project/build/bin/mlir-opt -lift-cf-to-scf a.nlJ0gHVYNB.mlir
#0 0x0000561cf4304859 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /data/szy/MLIR/llvm-debug/llvm-project/llvm/lib/Support/Unix/Signals.inc:723:11
#1 0x0000561cf4304d0b PrintStackTraceSignalHandler(void*) /data/szy/MLIR/llvm-debug/llvm-project/llvm/lib/Support/Unix/Signals.inc:798:1
#2 0x0000561cf4302f3f llvm::sys::RunSignalHandlers() /data/szy/MLIR/llvm-debug/llvm-project/llvm/lib/Support/Signals.cpp:105:5
#3 0x0000561cf43053de SignalHandler(int) /data/szy/MLIR/llvm-debug/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
#4 0x00007f4370322420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#5 0x00007f436f95f00b raise /build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#6 0x00007f436f93e859 abort /build/glibc-LcI20x/glibc-2.31/stdlib/abort.c:81:7
#7 0x00007f436f93e729 get_sysdep_segment_value /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:509:8
#8 0x00007f436f93e729 _nl_load_domain /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:970:34
#9 0x00007f436f94ffd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#10 0x0000561cf98a9af4 mlir::IRObjectWithUseList<mlir::BlockOperand>::~IRObjectWithUseList() /data/szy/MLIR/llvm-debug/llvm-project/mlir/include/mlir/IR/UseDefLists.h:199:3
#11 0x0000561cf98a7e6f mlir::Block::~Block() /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/IR/Block.cpp:24:1
#12 0x0000561cf459d963 llvm::ilist_alloc_traits<mlir::Block>::deleteNode(mlir::Block*) /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/ilist.h:42:39
#13 0x0000561cf459d925 llvm::iplist_impl<llvm::simple_ilist<mlir::Block>, llvm::ilist_traits<mlir::Block>>::erase(llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Block, true, false, void, false, void>, false, false>) /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/ilist.h:206:12
#14 0x0000561cf459d8d4 llvm::iplist_impl<llvm::simple_ilist<mlir::Block>, llvm::ilist_traits<mlir::Block>>::erase(llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Block, true, false, void, false, void>, false, false>, llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Block, true, false, void, false, void>, false, false>) /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/ilist.h:242:15
#15 0x0000561cf459d7fb llvm::iplist_impl<llvm::simple_ilist<mlir::Block>, llvm::ilist_traits<mlir::Block>>::clear() /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/ilist.h:246:18
#16 0x0000561cf9a3d955 llvm::iplist_impl<llvm::simple_ilist<mlir::Block>, llvm::ilist_traits<mlir::Block>>::~iplist_impl() /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/ilist.h:147:29
#17 0x0000561cf9a3d615 llvm::iplist<mlir::Block>::~iplist() /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/ilist.h:327:7
#18 0x0000561cf9a3c232 mlir::Region::~Region() /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/IR/Region.cpp:20:1
#19 0x0000561cf978bec5 void std::_Destroy<mlir::Region>(mlir::Region*) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_construct.h:98:26
#20 0x0000561cf978be93 void std::_Destroy_aux<false>::__destroy<mlir::Region*>(mlir::Region*, mlir::Region*) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_construct.h:107:30
#21 0x0000561cf978be5d void std::_Destroy<mlir::Region*>(mlir::Region*, mlir::Region*) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_construct.h:138:5
#22 0x0000561cf978bde1 void std::_Destroy<mlir::Region*, mlir::Region>(mlir::Region*, mlir::Region*, std::allocator<mlir::Region>&) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_construct.h:207:5
#23 0x0000561cf9787778 std::vector<mlir::Region, std::allocator<mlir::Region>>::~vector() /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_vector.h:677:2
#24 0x0000561cf9770953 transformToStructuredCFBranches(mlir::Block*, llvm::function_ref<mlir::Value (unsigned int)>, llvm::function_ref<mlir::Value (mlir::Type)>, mlir::CFGToSCFInterface&, mlir::DominanceInfo&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Transforms/Utils/CFGToSCF.cpp:1207:1
#25 0x0000561cf976e820 mlir::transformCFGToSCF(mlir::Region&, mlir::CFGToSCFInterface&, mlir::DominanceInfo&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Transforms/Utils/CFGToSCF.cpp:1343:16
#26 0x0000561cf863ab65 (anonymous namespace)::LiftControlFlowToSCF::runOnOperation()::'lambda'(mlir::func::FuncOp)::operator()(mlir::func::FuncOp) const::'lambda'(mlir::Operation*)::operator()(mlir::Operation*) const /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Conversion/ControlFlowToSCF/ControlFlowToSCF.cpp:178:15
#27 0x0000561cf863aadd mlir::WalkResult llvm::function_ref<mlir::WalkResult (mlir::Operation*)>::callback_fn<(anonymous namespace)::LiftControlFlowToSCF::runOnOperation()::'lambda'(mlir::func::FuncOp)::operator()(mlir::func::FuncOp) const::'lambda'(mlir::Operation*)>(long, mlir::Operation*) /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:12
#28 0x0000561cf450daa1 llvm::function_ref<mlir::WalkResult (mlir::Operation*)>::operator()(mlir::Operation*) const /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:12
#29 0x0000561cf450da66 mlir::WalkResult mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Operation*)>, mlir::WalkOrder) /data/szy/MLIR/llvm-debug/llvm-project/mlir/include/mlir/IR/Visitors.h:280:12
#30 0x0000561cf863aa82 std::enable_if<llvm::is_one_of<mlir::Operation*, mlir::Operation*, mlir::Region*, mlir::Block*>::value, mlir::WalkResult>::type mlir::detail::walk<(mlir::WalkOrder)1, mlir::ForwardIterator, (anonymous namespace)::LiftControlFlowToSCF::runOnOperation()::'lambda'(mlir::func::FuncOp)::operator()(mlir::func::FuncOp) const::'lambda'(mlir::Operation*)&, mlir::Operation*, mlir::WalkResult>(mlir::Operation*, (anonymous namespace)::LiftControlFlowToSCF::runOnOperation()::'lambda'(mlir::func::FuncOp)::operator()(mlir::func::FuncOp) const::'lambda'(mlir::Operation*)&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/include/mlir/IR/Visitors.h:312:10
#31 0x0000561cf863aa2d std::enable_if<llvm::function_traits<std::decay<(anonymous namespace)::LiftControlFlowToSCF::runOnOperation()::'lambda'(mlir::func::FuncOp)::operator()(mlir::func::FuncOp) const::'lambda'(mlir::Operation*)&>::type>::num_args == 1, mlir::WalkResult>::type mlir::Operation::walk<(mlir::WalkOrder)1, mlir::ForwardIterator, (anonymous namespace)::LiftControlFlowToSCF::runOnOperation()::'lambda'(mlir::func::FuncOp)::operator()(mlir::func::FuncOp) const::'lambda'(mlir::Operation*)&, mlir::WalkResult>((anonymous namespace)::LiftControlFlowToSCF::runOnOperation()::'lambda'(mlir::func::FuncOp)::operator()(mlir::func::FuncOp) const::'lambda'(mlir::Operation*)&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/include/mlir/IR/Operation.h:794:12
#32 0x0000561cf863a9da (anonymous namespace)::LiftControlFlowToSCF::runOnOperation()::'lambda'(mlir::func::FuncOp)::operator()(mlir::func::FuncOp) const /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Conversion/ControlFlowToSCF/ControlFlowToSCF.cpp:187:19
#33 0x0000561cf863a8fc std::enable_if<!llvm::is_one_of<mlir::func::FuncOp, mlir::Operation*, mlir::Region*, mlir::Block*>::value && std::is_same<mlir::WalkResult, mlir::WalkResult>::value, mlir::WalkResult>::type mlir::detail::walk<(mlir::WalkOrder)1, mlir::ForwardIterator, (anonymous namespace)::LiftControlFlowToSCF::runOnOperation()::'lambda'(mlir::func::FuncOp), mlir::func::FuncOp, mlir::WalkResult>(mlir::Operation*, (anonymous namespace)::LiftControlFlowToSCF::runOnOperation()::'lambda'(mlir::func::FuncOp)&&)::'lambda'(mlir::Operation*)::operator()(mlir::Operation*) const /data/szy/MLIR/llvm-debug/llvm-project/mlir/include/mlir/IR/Visitors.h:375:14
#34 0x0000561cf863a89d mlir::WalkResult llvm::function_ref<mlir::WalkResult (mlir::Operation*)>::callback_fn<std::enable_if<!llvm::is_one_of<mlir::func::FuncOp, mlir::Operation*, mlir::Region*, mlir::Block*>::value && std::is_same<mlir::WalkResult, mlir::WalkResult>::value, mlir::WalkResult>::type mlir::detail::walk<(mlir::WalkOrder)1, mlir::ForwardIterator, (anonymous namespace)::LiftControlFlowToSCF::runOnOperation()::'lambda'(mlir::func::FuncOp), mlir::func::FuncOp, mlir::WalkResult>(mlir::Operation*, (anonymous namespace)::LiftControlFlowToSCF::runOnOperation()::'lambda'(mlir::func::FuncOp)&&)::'lambda'(mlir::Operation*)>(long, mlir::Operation*) /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:12
#35 0x0000561cf450daa1 llvm::function_ref<mlir::WalkResult (mlir::Operation*)>::operator()(mlir::Operation*) const /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:12
#36 0x0000561cf450da66 mlir::WalkResult mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Operation*)>, mlir::WalkOrder) /data/szy/MLIR/llvm-debug/llvm-project/mlir/include/mlir/IR/Visitors.h:280:12
#37 0x0000561cf450d9fb mlir::WalkResult mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Operation*)>, mlir::WalkOrder) /data/szy/MLIR/llvm-debug/llvm-project/mlir/include/mlir/IR/Visitors.h:273:13
#38 0x0000561cf863a83a std::enable_if<!llvm::is_one_of<mlir::func::FuncOp, mlir::Operation*, mlir::Region*, mlir::Block*>::value && std::is_same<mlir::WalkResult, mlir::WalkResult>::value, mlir::WalkResult>::type mlir::detail::walk<(mlir::WalkOrder)1, mlir::ForwardIterator, (anonymous namespace)::LiftControlFlowToSCF::runOnOperation()::'lambda'(mlir::func::FuncOp), mlir::func::FuncOp, mlir::WalkResult>(mlir::Operation*, (anonymous namespace)::LiftControlFlowToSCF::runOnOperation()::'lambda'(mlir::func::FuncOp)&&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/include/mlir/IR/Visitors.h:378:10
#39 0x0000561cf863a7dd std::enable_if<llvm::function_traits<std::decay<(anonymous namespace)::LiftControlFlowToSCF::runOnOperation()::'lambda'(mlir::func::FuncOp)>::type>::num_args == 1, mlir::WalkResult>::type mlir::Operation::walk<(mlir::WalkOrder)1, mlir::ForwardIterator, (anonymous namespace)::LiftControlFlowToSCF::runOnOperation()::'lambda'(mlir::func::FuncOp), mlir::WalkResult>((anonymous namespace)::LiftControlFlowToSCF::runOnOperation()::'lambda'(mlir::func::FuncOp)&&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/include/mlir/IR/Operation.h:794:12
#40 0x0000561cf863a65e (anonymous namespace)::LiftControlFlowToSCF::runOnOperation() /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Conversion/ControlFlowToSCF/ControlFlowToSCF.cpp:168:29
#41 0x0000561cf96d48c4 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int)::$_1::operator()() const /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Pass/Pass.cpp:0:17
#42 0x0000561cf96d4865 void llvm::function_ref<void ()>::callback_fn<mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int)::$_1>(long) /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:5
#43 0x0000561cf43288f9 llvm::function_ref<void ()>::operator()() const /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:5
#44 0x0000561cf96d755b void mlir::MLIRContext::executeAction<mlir::PassExecutionAction, mlir::Pass&>(llvm::function_ref<void ()>, llvm::ArrayRef<mlir::IRUnit>, mlir::Pass&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/include/mlir/IR/MLIRContext.h:276:3
#45 0x0000561cf96d04a0 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Pass/Pass.cpp:533:17
#46 0x0000561cf96d09b7 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Pass/Pass.cpp:593:16
#47 0x0000561cf96d22d8 mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Pass/Pass.cpp:904:10
#48 0x0000561cf96d220d mlir::PassManager::run(mlir::Operation*) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Pass/Pass.cpp:884:60
#49 0x0000561cf96c6b9d performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:413:17
#50 0x0000561cf96c6802 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, llvm::ThreadPoolInterface*) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:478:12
#51 0x0000561cf96c65fc 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 /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:561:12
#52 0x0000561cf96c6596 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&) /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:12
#53 0x0000561cf983d492 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 /data/szy/MLIR/llvm-debug/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:12
#54 0x0000561cf983caa5 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-debug/llvm-project/mlir/lib/Support/ToolUtilities.cpp:27:12
#55 0x0000561cf96c3483 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:564:10
#56 0x0000561cf96c3825 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:605:14
#57 0x0000561cf96c39f8 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) /data/szy/MLIR/llvm-debug/llvm-project/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp:621:10
#58 0x0000561cf428ea23 main /data/szy/MLIR/llvm-debug/llvm-project/mlir/tools/mlir-opt/mlir-opt.cpp:317:33
#59 0x00007f436f940083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#60 0x0000561cf428e64e _start (/data/szy/MLIR/llvm-debug/llvm-project/build/bin/mlir-opt+0x251464e)