Issue |
128319
|
Summary |
[MLIR]`-lift-cf-to-scf` triggers Assertion Failure `use_empty() && "Cannot destroy a value that still has uses!"'
|
Labels |
mlir
|
Assignees |
|
Reporter |
xisang0
|
Test on commit: https://github.com/llvm/llvm-project/commit/a9882bda96228ca23e166a817f93a7dbc99763cb
steps to reproduce:
```
mlir-opt test.mlir -lift-cf-to-scf
```
test case:
```
module {
func.func @loop(%count : i32) -> () {
%zero = spirv.Constant 0: i32
%_one_ = spirv.Constant 1: i32
%var = spirv.Variable init(%zero) : !spirv.ptr<i32, Function>
spirv.mlir.loop {
spirv.Branch ^header
^header:
%val0 = spirv.Load "Function" %var : i32
%cmp = spirv.SLessThan %val0, %count : i32
spirv.BranchConditional %cmp, ^body, ^merge
^body:
spirv.Branch ^continue
^continue:
%val1 = spirv.Load "Function" %var : i32
%add = spirv.IAdd %val1, %one : i32
spirv.Store "Function" %var, %add : i32
spirv.Branch ^header
^merge:
spirv.mlir.merge
}
return
}
}
```
crash trace:
```
mlir-opt: /home/workdir/llvm-project-19/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: ./mlir-opt /home/workdir/test.mlir -lift-cf-to-scf
#0 0x000062ab97598998 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./mlir-opt+0x108a998)
#1 0x000062ab975964be llvm::sys::RunSignalHandlers() (./mlir-opt+0x10884be)
#2 0x000062ab975993a8 SignalHandler(int) Signals.cpp:0:0
#3 0x00007c0421c2d520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007c0421c819fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x00007c0421c2d476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007c0421c137f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x00007c0421c1371b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x00007c0421c24e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x000062ab9a948296 (./mlir-opt+0x443a296)
#10 0x000062ab9aa1c1b6 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>) (./mlir-opt+0x450e1b6)
#11 0x000062ab9aa1acab mlir::Region::~Region() (./mlir-opt+0x450ccab)
#12 0x000062ab9a8b5a58 mlir::transformCFGToSCF(mlir::Region&, mlir::CFGToSCFInterface&, mlir::DominanceInfo&) (./mlir-opt+0x43a7a58)
#13 0x000062ab99f57a1f 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*) ControlFlowToSCF.cpp:0:0
#14 0x000062ab976bff77 mlir::WalkResult mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Operation*)>, mlir::WalkOrder) (./mlir-opt+0x11b1f77)
#15 0x000062ab99f5767e 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*) ControlFlowToSCF.cpp:0:0
#16 0x000062ab976bff77 mlir::WalkResult mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<mlir::WalkResult (mlir::Operation*)>, mlir::WalkOrder) (./mlir-opt+0x11b1f77)
#17 0x000062ab99f5734a (anonymous namespace)::LiftControlFlowToSCF::runOnOperation() ControlFlowToSCF.cpp:0:0
#18 0x000062ab9a8693bf mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./mlir-opt+0x435b3bf)
#19 0x000062ab9a869ba2 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./mlir-opt+0x435bba2)
#20 0x000062ab9a86c34e mlir::PassManager::run(mlir::Operation*) (./mlir-opt+0x435e34e)
#21 0x000062ab9a864e6b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#22 0x000062ab9a864acb 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
#23 0x000062ab9a90ddf5 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+0x43ffdf5)
#24 0x000062ab9a85f9b2 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./mlir-opt+0x43519b2)
#25 0x000062ab9a85fc63 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x4351c63)
#26 0x000062ab9a85fe72 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x4351e72)
#27 0x000062ab97577c27 main (./mlir-opt+0x1069c27)
#28 0x00007c0421c14d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#29 0x00007c0421c14e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#30 0x000062ab97577795 _start (./mlir-opt+0x1069795)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs