Skip to content

[MLIR]-remove-dead-values triggers Assertion Failure `results.size() == 1 && "expected a single result type"' #116347

@xisang0

Description

@xisang0

Test on commit: 6548b63
steps to reproduce:

mlir-opt test.mlir --remove-dead-values

test case:

module {
  llvm.func @mlirAsyncRuntimeAddRef(!llvm.ptr, i64) attributes {sym_visibility = "private"}
  llvm.func @mlirAsyncRuntimeDropRef(!llvm.ptr, i64) attributes {sym_visibility = "private"}
}

crash trace:

mlir-opt: /home/workdir/llvm-project-19/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp:235: LLVMFunctionType mlir::LLVM::LLVMFunctionType::clone(TypeRange, TypeRange) const: Assertion `results.size() == 1 && "expected a single result type"' 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 --remove-dead-values
 #0 0x00005e6cc8bdf3b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./mlir-opt+0x10723b8)
 #1 0x00005e6cc8bdcede llvm::sys::RunSignalHandlers() (./mlir-opt+0x106fede)
 #2 0x00005e6cc8bdfdc8 SignalHandler(int) Signals.cpp:0:0
 #3 0x0000760f29753520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x0000760f297a79fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x0000760f29753476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x0000760f297397f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x0000760f2973971b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x0000760f2974ae96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x00005e6cca0f4566 mlir::LLVM::LLVMFunctionType::clone(mlir::TypeRange, mlir::TypeRange) const (./mlir-opt+0x2587566)
#10 0x00005e6cc9fdbb1e mlir::detail::FunctionOpInterfaceInterfaceTraits::Model<mlir::LLVM::LLVMFuncOp>::cloneTypeWith(mlir::detail::FunctionOpInterfaceInterfaceTraits::Concept const*, mlir::Operation*, mlir::TypeRange, mlir::TypeRange) (./mlir-opt+0x246eb1e)
#11 0x00005e6ccbd355f6 mlir::FunctionOpInterface::getTypeWithoutArgs(llvm::BitVector const&) (./mlir-opt+0x41c85f6)
#12 0x00005e6ccbe8fdb5 void llvm::function_ref<void (mlir::Operation*)>::callback_fn<(anonymous namespace)::RemoveDeadValues::runOnOperation()::$_1>(long, mlir::Operation*) RemoveDeadValues.cpp:0:0
#13 0x00005e6cc8ced71e void mlir::detail::walk<mlir::ForwardIterator>(mlir::Operation*, llvm::function_ref<void (mlir::Operation*)>, mlir::WalkOrder) (./mlir-opt+0x118071e)
#14 0x00005e6ccbe8f385 (anonymous namespace)::RemoveDeadValues::runOnOperation() RemoveDeadValues.cpp:0:0
#15 0x00005e6ccbe5b6df mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./mlir-opt+0x42ee6df)
#16 0x00005e6ccbe5bec2 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./mlir-opt+0x42eeec2)
#17 0x00005e6ccbe5e66e mlir::PassManager::run(mlir::Operation*) (./mlir-opt+0x42f166e)
#18 0x00005e6ccbe57192 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#19 0x00005e6ccbe56dfb 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 0x00005e6ccbf00ae5 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+0x4393ae5)
#21 0x00005e6ccbe51ff2 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./mlir-opt+0x42e4ff2)
#22 0x00005e6ccbe522a3 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x42e52a3)
#23 0x00005e6ccbe524b2 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x42e54b2)
#24 0x00005e6cc8bbe5d7 main (./mlir-opt+0x10515d7)
#25 0x0000760f2973ad90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#26 0x0000760f2973ae40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#27 0x00005e6cc8bbe145 _start (./mlir-opt+0x1051145)
Aborted (core dumped)

Metadata

Metadata

Assignees

Labels

crashPrefer [crash-on-valid] or [crash-on-invalid]mlir

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions