[mlir] Assertion `!hasLive(op->getResults(), nonLiveSet, la) && "expected the op to have no live results"' failed.
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
git version: 9e0aa61f75299f91b9e063ba46d2e33aa164cf7a
system: `Ubuntu 18.04.6 LTS`
reproduce with: `mlir-opt -remove-dead-values a.mlir`
a.mlir:
```mlir
module {
func.func @fuse(%arg0: memref, %arg1: memref<4x?xf32>) {
%c0 = arith.constant 0 : index
%c1 = arith.constant 1 : index
%c4 = arith.constant 4 : index
%cst = arith.constant 1.000000e+00 : f32
cf.br ^bb1(%c0 : index)
^bb1(%0: index): // 3 preds: ^bb0, ^bb5, ^bb6
%1 = arith.cmpi slt, %0, %c4 : index
cf.cond_br %1, ^bb2, ^bb7
^bb2: // pred: ^bb1
cf.br ^bb3(%c0 : index)
^bb3(%2: index): // 2 preds: ^bb2, ^bb4
%3 = arith.cmpi slt, %2, %c4 : index
cf.cond_br %3, ^bb4, ^bb6
^bb4: // pred: ^bb3
%4 = memref.load %arg0[%0, %2, %c1] : memref
%5 = arith.addf %4, %cst : f32
memref.store %5, %arg1[%0, %2] : memref<4x?xf32>
%6 = arith.addi %2, %c1 : index
cf.br ^bb3(%6 : index)
^bb5: // no predecessors
%7 = arith.addi %0, %c1 : index
cf.br ^bb1(%7 : index)
^bb6: // pred: ^bb3
%8 = arith.addi %0, %c1 : index
cf.br ^bb1(%8 : index)
^bb7: // pred: ^bb1
return
}
}
```
stack trace:
```
mlir-opt: /data/szy/MLIR/llvm-release/llvm-project/mlir/lib/Transforms/RemoveDeadValues.cpp:237: void (anonymous namespace)::processSimpleOp(Operation *, RunLivenessAnalysis &, DenseSet &, RDVFinalCleanupList &): Assertion `!hasLive(op->getResults(), nonLiveSet, la) && "expected the op to have no live results"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt -remove-dead-values 94.mlir
#0 0x000055fd23b217bb llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x200d7bb)
#1 0x000055fd23b1e621 llvm::sys::RunSignalHandlers() (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x200a621)
#2 0x000055fd23b228e6 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007f1b39993420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#4 0x00007f1b38fd000b raise /build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#5 0x00007f1b38faf859 abort /build/glibc-LcI20x/glibc-2.31/stdlib/abort.c:81:7
#6 0x00007f1b38faf729 get_sysdep_segment_value /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:509:8
#7 0x00007f1b38faf729 _nl_load_domain /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:970:34
#8 0x00007f1b38fc0fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#9 0x000055fd2c7bff6d (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xacabf6d)
#10 0x000055fd23be31ae void mlir::detail::walk(mlir::Operation*, llvm::function_ref, mlir::WalkOrder) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20cf1ae)
#11 0x000055fd23be31ae void mlir::detail::walk(mlir::Operation*, llvm::function_ref, mlir::WalkOrder) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20cf1ae)
#12 0x000055fd2c7b75ea (anonymous namespace)::RemoveDeadValues::runOnOperation() RemoveDeadValues.cpp:0:0
#13 0x000055fd2c8a1d58 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xad8dd58)
#14 0x000055fd2c8a2d34 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+0xad8ed34)
#15 0x000055fd2c8a9dba mlir::PassManager::runPasses(mlir::Operation*, mlir::AnalysisManager) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xad95dba)
#16 0x000055fd2c8a967f mlir::PassManager::run(mlir::Operation*) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xad9567f)
#17 0x000055fd23bd07f0 performActions(llvm::raw_ostream&, std::shared_ptr const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#18 0x000055fd23bcfa26 llvm::LogicalResult llvm::function_ref>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>::callback_fn>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::$_0>(long, std::unique_ptr>, llvm::MemoryBufferRef const&, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#19 0x000055fd2cc09cd6 mlir::splitAndProcessBuffer(std::unique_ptr>, llvm::function_ref>, llvm::MemoryBufferRef const&, llvm::raw_ostream&)>, llvm::raw_ostream&, llvm::StringRef, llvm::StringRef) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0xb0f5cd6)
#20 0x000055fd23bc6b76 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20b2b76)
#21 0x000055fd23bc6f5a mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20b2f5a)
#22 0x000055fd23bc72b5 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x20b32b5)
#23 0x000055fd23b070c2 main (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1ff30c2)
#24 0x00007f1b38fb1083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#25 0x000055fd23b06bfe _start (/data/szy/MLIR/llvm-release/llvm-project/build/bin/mlir-opt+0x1ff2bfe)
Aborted (core dumped)
```
Contributor guide
Research direction
Start with mlir/lib/Transforms/RemoveDeadValues.cpp, especially the assertion near line 237 and the RemoveDeadValues pass entry point. Run mlir-opt -remove-dead-values a.mlir with the provided reproducer, then trace why the operation still has live results. Done means the reproducer completes without triggering the assertion and has a regression test.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100