Issue |
131449
|
Summary |
[MLIR] Assertion violation in `-remove-dead-values` pass: failure message `(start + length) <= owner->getNumOperands() && "invalid range
|
Labels |
mlir
|
Assignees |
|
Reporter |
sweead
|
test commit: [bbd1bb4](https://github.com/llvm/llvm-project/commit/bbd1bb40573dd5a36dc04af4ad307d6e16456f89)
step to reproduce:
```
mlir-opt test.mlir --remove-dead-values
```
test case:
```
module {
llvm.func @malloc(i64) -> !llvm.ptr attributes {sym_visibility = "private"}
func.func private @main(%arg0: tensor<4x4xf32>, %arg1: tensor<*xf32>, %arg2: tensor<*xf32>, %arg3: tensor<2x3xi32>, %arg4: tensor<2x3xi32>) -> memref<4x1xf32> attributes {arm_streaming_compatible, pattern_driver_all_erased = true, pattern_driver_changed = false} {
%0 = llvm.mlir.constant(0 : index) : i64
%1 = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
%2 = llvm.call @malloc(%0) : (i64) -> !llvm.ptr
%3 = llvm.insertvalue %2, %1[0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
%4 = builtin.unrealized_conversion_cast %3 : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> to memref<4xf32>
%5 = builtin.unrealized_conversion_cast %0 : i64 to index
cf.br ^bb1(%5 : index)
^bb1(%6: index): // 2 preds: ^bb0, ^bb2
%7 = builtin.unrealized_conversion_cast %6 : index to i64
%8 = llvm.icmp "slt" %7, %0 : i64
llvm.cond_br %8, ^bb2, ^bb3
^bb2: // pred: ^bb1
%9 = builtin.unrealized_conversion_cast %6 : index to i64
%10 = builtin.unrealized_conversion_cast %9 : i64 to index
cf.br ^bb1(%10 : index)
^bb3: // pred: ^bb1
%expand_shape = memref.expand_shape %4 [[0, 1]] output_shape [4, 1] : memref<4xf32> into memref<4x1xf32>
return %expand_shape : memref<4x1xf32>
}
}
```
Crash backtrace:
```
mlir-opt: /home/workdir/llvm-project/mlir/lib/IR/OperationSupport.cpp:430: mlir::MutableOperandRange::MutableOperandRange(Operation *, unsigned int, unsigned int, ArrayRef<OperandSegment>): Assertion `(start + length) <= owner->getNumOperands() && "invalid range"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /home/workdir/llvm-project/build/bin/./mlir-opt test.mlir --remove-dead-values
#0 0x0000562ffdc0e158 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x12d3158)
#1 0x0000562ffdc0bc7e llvm::sys::RunSignalHandlers() (/home/workdir/llvm-project/build/bin/./mlir-opt+0x12d0c7e)
#2 0x0000562ffdc0eb61 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007fea04dbb520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007fea04e0f9fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x00007fea04dbb476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007fea04da17f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x00007fea04da171b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x00007fea04db2e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x0000563000eb304c (/home/workdir/llvm-project/build/bin/./mlir-opt+0x457804c)
#10 0x0000562ffef55152 mlir::LLVM::CondBrOp::getTrueDestOperandsMutable() (/home/workdir/llvm-project/build/bin/./mlir-opt+0x261a152)
#11 0x0000562ffef55051 mlir::LLVM::CondBrOp::getSuccessorOperands(unsigned int) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x261a051)
#12 0x0000562fff112b6a mlir::detail::BranchOpInterfaceInterfaceTraits::Model<mlir::LLVM::CondBrOp>::getSuccessorOperands(mlir::detail::BranchOpInterfaceInterfaceTraits::Concept const*, mlir::Operation*, unsigned int) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x27d7b6a)
#13 0x00005630034e847f mlir::BranchOpInterface::getSuccessorOperands(unsigned int) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x6bad47f)
#14 0x0000563000d3e25b (anonymous namespace)::RemoveDeadValues::runOnOperation() RemoveDeadValues.cpp:0:0
#15 0x0000563000d078a3 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x43cc8a3)
#16 0x0000563000d08142 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x43cd142)
#17 0x0000563000d0a91e mlir::PassManager::run(mlir::Operation*) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x43cf91e)
#18 0x0000563000d02e9b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#19 0x0000563000d02af3 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
#20 0x0000563000dae065 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) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x4473065)
#21 0x0000563000cfc752 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x43c1752)
#22 0x0000563000cfca03 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x43c1a03)
#23 0x0000563000cfcc12 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/home/workdir/llvm-project/build/bin/./mlir-opt+0x43c1c12)
#24 0x0000562ffdbed8df main (/home/workdir/llvm-project/build/bin/./mlir-opt+0x12b28df)
#25 0x00007fea04da2d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#26 0x00007fea04da2e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#27 0x0000562ffdbed435 _start (/home/workdir/llvm-project/build/bin/./mlir-opt+0x12b2435)
Aborted (core dumped)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs