Open Tai78641 opened 1 year ago
here is the valgrind output:
==52859== Memcheck, a memory error detector
==52859== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==52859== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==52859== Command: /staging/llvm-project/build/bin/mlir-opt -allow-unregistered-dialect /staging/llvm-project/mlir/test/Transforms/test-rewrite-dynamic-op.mlir -test-rewrite-dynamic-op
==52859==
==52859== Invalid read of size 8
==52859== at 0x1B1CD07: mlir::OperationName::getDialectNamespace() const (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A1A814: mlir::ConversionTarget::getOpInfo(mlir::OperationName) const (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A1AB9B: mlir::ConversionTarget::isLegal(mlir::Operation*) const (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A2089C: computeConversionSet(llvm::iterator_range<llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Block, false, false, void>, false, false> >, mlir::Location, llvm::SmallVectorImpl<mlir::Operation*>&, mlir::ConversionTarget*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A295AD: (anonymous namespace)::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>, llvm::function_ref<void (mlir::Diagnostic&)>) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A2C4A3: mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void> >*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1874D76: (anonymous namespace)::TestRewriteDynamicOpDriver::runOnOperation() (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C3DE8: mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C44A0: mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C30C4: mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C3ABC: mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C44A0: mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== Address 0x4f81e40 is 16 bytes inside a block of size 112 free'd
==52859== at 0x483D1CF: operator delete(void*, unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==52859== by 0x1B21EDA: mlir::RegisteredOperationName::insert(std::unique_ptr<mlir::OperationName::Impl, std::default_delete<mlir::OperationName::Impl> >, llvm::ArrayRef<llvm::StringRef>) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1B0A5E2: mlir::ExtensibleDialect::registerDynamicOp(std::unique_ptr<mlir::DynamicOpDefinition, std::default_delete<mlir::DynamicOpDefinition> >&&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x18201F8: test::TestDialect::initialize() (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1820A1B: test::TestDialect::TestDialect(mlir::MLIRContext*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x16C5895: std::unique_ptr<mlir::Dialect, std::default_delete<mlir::Dialect> > llvm::function_ref<std::unique_ptr<mlir::Dialect, std::default_delete<mlir::Dialect> > ()>::callback_fn<test::TestDialect* mlir::MLIRContext::getOrLoadDialect<test::TestDialect>()::{lambda()#1}>(long) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1B1BEF1: mlir::MLIRContext::getOrLoadDialect(llvm::StringRef, mlir::TypeID, llvm::function_ref<std::unique_ptr<mlir::Dialect, std::default_delete<mlir::Dialect> > ()>) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x16C5650: std::_Function_handler<mlir::Dialect* (mlir::MLIRContext*), void mlir::DialectRegistry::insert<test::TestDialect>()::{lambda(mlir::MLIRContext*)#1}>::_M_invoke(std::_Any_data const&, mlir::MLIRContext*&&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1AFA0D8: mlir::Dialect* llvm::function_ref<mlir::Dialect* (mlir::MLIRContext*)>::callback_fn<std::function<mlir::Dialect* (mlir::MLIRContext*)> const>(long, mlir::MLIRContext*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C4C36: mlir::PassManager::run(mlir::Operation*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19B5292: performActions(llvm::raw_ostream&, bool, bool, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, bool, bool) [clone .constprop.0] (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19B599E: processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, bool, bool, bool, bool, bool, bool, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, llvm::ThreadPool*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== Block was alloc'd at
==52859== at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==52859== by 0x1B21A59: mlir::OperationName::OperationName(llvm::StringRef, mlir::MLIRContext*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1B35528: mlir::OperationState::OperationState(mlir::Location, llvm::StringRef) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D98FEE: (anonymous namespace)::OperationParser::parseGenericOperation() (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D99C77: (anonymous namespace)::OperationParser::parseOperation() (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D9C683: (anonymous namespace)::OperationParser::parseBlock(mlir::Block*&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D9CEB6: (anonymous namespace)::OperationParser::parseRegionBody(mlir::Region&, llvm::SMLoc, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D9D660: (anonymous namespace)::OperationParser::parseRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D9D7FC: (anonymous namespace)::CustomOpAsmParser::parseOptionalRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1B10B15: mlir::function_interface_impl::parseFunctionOp(mlir::OpAsmParser&, mlir::OperationState&, bool, mlir::StringAttr, llvm::function_ref<mlir::Type (mlir::Builder&, llvm::ArrayRef<mlir::Type>, llvm::ArrayRef<mlir::Type>, mlir::function_interface_impl::VariadicFlag, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)>, mlir::StringAttr, mlir::StringAttr) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x764B3D: mlir::func::FuncOp::parse(mlir::OpAsmParser&, mlir::OperationState&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D99905: (anonymous namespace)::OperationParser::parseOperation() (in /staging/llvm-project/build/bin/mlir-opt)
==52859==
==52859== Invalid read of size 8
==52859== at 0x1B1CD40: mlir::OperationName::getDialectNamespace() const (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A1A814: mlir::ConversionTarget::getOpInfo(mlir::OperationName) const (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A1AB9B: mlir::ConversionTarget::isLegal(mlir::Operation*) const (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A2089C: computeConversionSet(llvm::iterator_range<llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Block, false, false, void>, false, false> >, mlir::Location, llvm::SmallVectorImpl<mlir::Operation*>&, mlir::ConversionTarget*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A295AD: (anonymous namespace)::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>, llvm::function_ref<void (mlir::Diagnostic&)>) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A2C4A3: mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void> >*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1874D76: (anonymous namespace)::TestRewriteDynamicOpDriver::runOnOperation() (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C3DE8: mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C44A0: mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C30C4: mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C3ABC: mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C44A0: mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== Address 0x4f81e38 is 8 bytes inside a block of size 112 free'd
==52859== at 0x483D1CF: operator delete(void*, unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==52859== by 0x1B21EDA: mlir::RegisteredOperationName::insert(std::unique_ptr<mlir::OperationName::Impl, std::default_delete<mlir::OperationName::Impl> >, llvm::ArrayRef<llvm::StringRef>) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1B0A5E2: mlir::ExtensibleDialect::registerDynamicOp(std::unique_ptr<mlir::DynamicOpDefinition, std::default_delete<mlir::DynamicOpDefinition> >&&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x18201F8: test::TestDialect::initialize() (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1820A1B: test::TestDialect::TestDialect(mlir::MLIRContext*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x16C5895: std::unique_ptr<mlir::Dialect, std::default_delete<mlir::Dialect> > llvm::function_ref<std::unique_ptr<mlir::Dialect, std::default_delete<mlir::Dialect> > ()>::callback_fn<test::TestDialect* mlir::MLIRContext::getOrLoadDialect<test::TestDialect>()::{lambda()#1}>(long) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1B1BEF1: mlir::MLIRContext::getOrLoadDialect(llvm::StringRef, mlir::TypeID, llvm::function_ref<std::unique_ptr<mlir::Dialect, std::default_delete<mlir::Dialect> > ()>) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x16C5650: std::_Function_handler<mlir::Dialect* (mlir::MLIRContext*), void mlir::DialectRegistry::insert<test::TestDialect>()::{lambda(mlir::MLIRContext*)#1}>::_M_invoke(std::_Any_data const&, mlir::MLIRContext*&&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1AFA0D8: mlir::Dialect* llvm::function_ref<mlir::Dialect* (mlir::MLIRContext*)>::callback_fn<std::function<mlir::Dialect* (mlir::MLIRContext*)> const>(long, mlir::MLIRContext*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C4C36: mlir::PassManager::run(mlir::Operation*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19B5292: performActions(llvm::raw_ostream&, bool, bool, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, bool, bool) [clone .constprop.0] (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19B599E: processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, bool, bool, bool, bool, bool, bool, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, llvm::ThreadPool*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== Block was alloc'd at
==52859== at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==52859== by 0x1B21A59: mlir::OperationName::OperationName(llvm::StringRef, mlir::MLIRContext*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1B35528: mlir::OperationState::OperationState(mlir::Location, llvm::StringRef) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D98FEE: (anonymous namespace)::OperationParser::parseGenericOperation() (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D99C77: (anonymous namespace)::OperationParser::parseOperation() (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D9C683: (anonymous namespace)::OperationParser::parseBlock(mlir::Block*&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D9CEB6: (anonymous namespace)::OperationParser::parseRegionBody(mlir::Region&, llvm::SMLoc, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D9D660: (anonymous namespace)::OperationParser::parseRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D9D7FC: (anonymous namespace)::CustomOpAsmParser::parseOptionalRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1B10B15: mlir::function_interface_impl::parseFunctionOp(mlir::OpAsmParser&, mlir::OperationState&, bool, mlir::StringAttr, llvm::function_ref<mlir::Type (mlir::Builder&, llvm::ArrayRef<mlir::Type>, llvm::ArrayRef<mlir::Type>, mlir::function_interface_impl::VariadicFlag, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)>, mlir::StringAttr, mlir::StringAttr) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x764B3D: mlir::func::FuncOp::parse(mlir::OpAsmParser&, mlir::OperationState&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D99905: (anonymous namespace)::OperationParser::parseOperation() (in /staging/llvm-project/build/bin/mlir-opt)
==52859==
==52859== Invalid read of size 8
==52859== at 0x1B1CD07: mlir::OperationName::getDialectNamespace() const (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A1A814: mlir::ConversionTarget::getOpInfo(mlir::OperationName) const (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A1AB9B: mlir::ConversionTarget::isLegal(mlir::Operation*) const (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A290BB: (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A296A1: (anonymous namespace)::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>, llvm::function_ref<void (mlir::Diagnostic&)>) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A2C4A3: mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void> >*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1874D76: (anonymous namespace)::TestRewriteDynamicOpDriver::runOnOperation() (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C3DE8: mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C44A0: mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C30C4: mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C3ABC: mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C44A0: mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== Address 0x4f81e40 is 16 bytes inside a block of size 112 free'd
==52859== at 0x483D1CF: operator delete(void*, unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==52859== by 0x1B21EDA: mlir::RegisteredOperationName::insert(std::unique_ptr<mlir::OperationName::Impl, std::default_delete<mlir::OperationName::Impl> >, llvm::ArrayRef<llvm::StringRef>) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1B0A5E2: mlir::ExtensibleDialect::registerDynamicOp(std::unique_ptr<mlir::DynamicOpDefinition, std::default_delete<mlir::DynamicOpDefinition> >&&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x18201F8: test::TestDialect::initialize() (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1820A1B: test::TestDialect::TestDialect(mlir::MLIRContext*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x16C5895: std::unique_ptr<mlir::Dialect, std::default_delete<mlir::Dialect> > llvm::function_ref<std::unique_ptr<mlir::Dialect, std::default_delete<mlir::Dialect> > ()>::callback_fn<test::TestDialect* mlir::MLIRContext::getOrLoadDialect<test::TestDialect>()::{lambda()#1}>(long) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1B1BEF1: mlir::MLIRContext::getOrLoadDialect(llvm::StringRef, mlir::TypeID, llvm::function_ref<std::unique_ptr<mlir::Dialect, std::default_delete<mlir::Dialect> > ()>) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x16C5650: std::_Function_handler<mlir::Dialect* (mlir::MLIRContext*), void mlir::DialectRegistry::insert<test::TestDialect>()::{lambda(mlir::MLIRContext*)#1}>::_M_invoke(std::_Any_data const&, mlir::MLIRContext*&&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1AFA0D8: mlir::Dialect* llvm::function_ref<mlir::Dialect* (mlir::MLIRContext*)>::callback_fn<std::function<mlir::Dialect* (mlir::MLIRContext*)> const>(long, mlir::MLIRContext*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C4C36: mlir::PassManager::run(mlir::Operation*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19B5292: performActions(llvm::raw_ostream&, bool, bool, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, bool, bool) [clone .constprop.0] (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19B599E: processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, bool, bool, bool, bool, bool, bool, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, llvm::ThreadPool*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== Block was alloc'd at
==52859== at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==52859== by 0x1B21A59: mlir::OperationName::OperationName(llvm::StringRef, mlir::MLIRContext*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1B35528: mlir::OperationState::OperationState(mlir::Location, llvm::StringRef) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D98FEE: (anonymous namespace)::OperationParser::parseGenericOperation() (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D99C77: (anonymous namespace)::OperationParser::parseOperation() (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D9C683: (anonymous namespace)::OperationParser::parseBlock(mlir::Block*&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D9CEB6: (anonymous namespace)::OperationParser::parseRegionBody(mlir::Region&, llvm::SMLoc, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D9D660: (anonymous namespace)::OperationParser::parseRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D9D7FC: (anonymous namespace)::CustomOpAsmParser::parseOptionalRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1B10B15: mlir::function_interface_impl::parseFunctionOp(mlir::OpAsmParser&, mlir::OperationState&, bool, mlir::StringAttr, llvm::function_ref<mlir::Type (mlir::Builder&, llvm::ArrayRef<mlir::Type>, llvm::ArrayRef<mlir::Type>, mlir::function_interface_impl::VariadicFlag, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)>, mlir::StringAttr, mlir::StringAttr) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x764B3D: mlir::func::FuncOp::parse(mlir::OpAsmParser&, mlir::OperationState&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D99905: (anonymous namespace)::OperationParser::parseOperation() (in /staging/llvm-project/build/bin/mlir-opt)
==52859==
==52859== Invalid read of size 8
==52859== at 0x1B1CD40: mlir::OperationName::getDialectNamespace() const (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A1A814: mlir::ConversionTarget::getOpInfo(mlir::OperationName) const (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A1AB9B: mlir::ConversionTarget::isLegal(mlir::Operation*) const (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A290BB: (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A296A1: (anonymous namespace)::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>, llvm::function_ref<void (mlir::Diagnostic&)>) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A2C4A3: mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void> >*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1874D76: (anonymous namespace)::TestRewriteDynamicOpDriver::runOnOperation() (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C3DE8: mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C44A0: mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C30C4: mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C3ABC: mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C44A0: mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== Address 0x4f81e38 is 8 bytes inside a block of size 112 free'd
==52859== at 0x483D1CF: operator delete(void*, unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==52859== by 0x1B21EDA: mlir::RegisteredOperationName::insert(std::unique_ptr<mlir::OperationName::Impl, std::default_delete<mlir::OperationName::Impl> >, llvm::ArrayRef<llvm::StringRef>) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1B0A5E2: mlir::ExtensibleDialect::registerDynamicOp(std::unique_ptr<mlir::DynamicOpDefinition, std::default_delete<mlir::DynamicOpDefinition> >&&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x18201F8: test::TestDialect::initialize() (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1820A1B: test::TestDialect::TestDialect(mlir::MLIRContext*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x16C5895: std::unique_ptr<mlir::Dialect, std::default_delete<mlir::Dialect> > llvm::function_ref<std::unique_ptr<mlir::Dialect, std::default_delete<mlir::Dialect> > ()>::callback_fn<test::TestDialect* mlir::MLIRContext::getOrLoadDialect<test::TestDialect>()::{lambda()#1}>(long) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1B1BEF1: mlir::MLIRContext::getOrLoadDialect(llvm::StringRef, mlir::TypeID, llvm::function_ref<std::unique_ptr<mlir::Dialect, std::default_delete<mlir::Dialect> > ()>) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x16C5650: std::_Function_handler<mlir::Dialect* (mlir::MLIRContext*), void mlir::DialectRegistry::insert<test::TestDialect>()::{lambda(mlir::MLIRContext*)#1}>::_M_invoke(std::_Any_data const&, mlir::MLIRContext*&&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1AFA0D8: mlir::Dialect* llvm::function_ref<mlir::Dialect* (mlir::MLIRContext*)>::callback_fn<std::function<mlir::Dialect* (mlir::MLIRContext*)> const>(long, mlir::MLIRContext*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C4C36: mlir::PassManager::run(mlir::Operation*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19B5292: performActions(llvm::raw_ostream&, bool, bool, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, bool, bool) [clone .constprop.0] (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19B599E: processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, bool, bool, bool, bool, bool, bool, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, llvm::ThreadPool*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== Block was alloc'd at
==52859== at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==52859== by 0x1B21A59: mlir::OperationName::OperationName(llvm::StringRef, mlir::MLIRContext*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1B35528: mlir::OperationState::OperationState(mlir::Location, llvm::StringRef) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D98FEE: (anonymous namespace)::OperationParser::parseGenericOperation() (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D99C77: (anonymous namespace)::OperationParser::parseOperation() (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D9C683: (anonymous namespace)::OperationParser::parseBlock(mlir::Block*&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D9CEB6: (anonymous namespace)::OperationParser::parseRegionBody(mlir::Region&, llvm::SMLoc, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D9D660: (anonymous namespace)::OperationParser::parseRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D9D7FC: (anonymous namespace)::CustomOpAsmParser::parseOptionalRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1B10B15: mlir::function_interface_impl::parseFunctionOp(mlir::OpAsmParser&, mlir::OperationState&, bool, mlir::StringAttr, llvm::function_ref<mlir::Type (mlir::Builder&, llvm::ArrayRef<mlir::Type>, llvm::ArrayRef<mlir::Type>, mlir::function_interface_impl::VariadicFlag, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)>, mlir::StringAttr, mlir::StringAttr) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x764B3D: mlir::func::FuncOp::parse(mlir::OpAsmParser&, mlir::OperationState&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D99905: (anonymous namespace)::OperationParser::parseOperation() (in /staging/llvm-project/build/bin/mlir-opt)
==52859==
==52859== Invalid read of size 8
==52859== at 0x1A9DB78: mlir::OpBuilder::tryFold(mlir::Operation*, llvm::SmallVectorImpl<mlir::Value>&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A291F9: (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A296A1: (anonymous namespace)::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>, llvm::function_ref<void (mlir::Diagnostic&)>) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A2C4A3: mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void> >*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1874D76: (anonymous namespace)::TestRewriteDynamicOpDriver::runOnOperation() (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C3DE8: mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C44A0: mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C30C4: mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C3ABC: mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C44A0: mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C503B: mlir::PassManager::run(mlir::Operation*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19B5292: performActions(llvm::raw_ostream&, bool, bool, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, bool, bool) [clone .constprop.0] (in /staging/llvm-project/build/bin/mlir-opt)
==52859== Address 0x4f81e30 is 0 bytes inside a block of size 112 free'd
==52859== at 0x483D1CF: operator delete(void*, unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==52859== by 0x1B21EDA: mlir::RegisteredOperationName::insert(std::unique_ptr<mlir::OperationName::Impl, std::default_delete<mlir::OperationName::Impl> >, llvm::ArrayRef<llvm::StringRef>) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1B0A5E2: mlir::ExtensibleDialect::registerDynamicOp(std::unique_ptr<mlir::DynamicOpDefinition, std::default_delete<mlir::DynamicOpDefinition> >&&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x18201F8: test::TestDialect::initialize() (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1820A1B: test::TestDialect::TestDialect(mlir::MLIRContext*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x16C5895: std::unique_ptr<mlir::Dialect, std::default_delete<mlir::Dialect> > llvm::function_ref<std::unique_ptr<mlir::Dialect, std::default_delete<mlir::Dialect> > ()>::callback_fn<test::TestDialect* mlir::MLIRContext::getOrLoadDialect<test::TestDialect>()::{lambda()#1}>(long) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1B1BEF1: mlir::MLIRContext::getOrLoadDialect(llvm::StringRef, mlir::TypeID, llvm::function_ref<std::unique_ptr<mlir::Dialect, std::default_delete<mlir::Dialect> > ()>) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x16C5650: std::_Function_handler<mlir::Dialect* (mlir::MLIRContext*), void mlir::DialectRegistry::insert<test::TestDialect>()::{lambda(mlir::MLIRContext*)#1}>::_M_invoke(std::_Any_data const&, mlir::MLIRContext*&&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1AFA0D8: mlir::Dialect* llvm::function_ref<mlir::Dialect* (mlir::MLIRContext*)>::callback_fn<std::function<mlir::Dialect* (mlir::MLIRContext*)> const>(long, mlir::MLIRContext*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C4C36: mlir::PassManager::run(mlir::Operation*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19B5292: performActions(llvm::raw_ostream&, bool, bool, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, bool, bool) [clone .constprop.0] (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19B599E: processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >, bool, bool, bool, bool, bool, bool, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, llvm::ThreadPool*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== Block was alloc'd at
==52859== at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==52859== by 0x1B21A59: mlir::OperationName::OperationName(llvm::StringRef, mlir::MLIRContext*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1B35528: mlir::OperationState::OperationState(mlir::Location, llvm::StringRef) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D98FEE: (anonymous namespace)::OperationParser::parseGenericOperation() (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D99C77: (anonymous namespace)::OperationParser::parseOperation() (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D9C683: (anonymous namespace)::OperationParser::parseBlock(mlir::Block*&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D9CEB6: (anonymous namespace)::OperationParser::parseRegionBody(mlir::Region&, llvm::SMLoc, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D9D660: (anonymous namespace)::OperationParser::parseRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D9D7FC: (anonymous namespace)::CustomOpAsmParser::parseOptionalRegion(mlir::Region&, llvm::ArrayRef<mlir::OpAsmParser::Argument>, bool) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1B10B15: mlir::function_interface_impl::parseFunctionOp(mlir::OpAsmParser&, mlir::OperationState&, bool, mlir::StringAttr, llvm::function_ref<mlir::Type (mlir::Builder&, llvm::ArrayRef<mlir::Type>, llvm::ArrayRef<mlir::Type>, mlir::function_interface_impl::VariadicFlag, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)>, mlir::StringAttr, mlir::StringAttr) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x764B3D: mlir::func::FuncOp::parse(mlir::OpAsmParser&, mlir::OperationState&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1D99905: (anonymous namespace)::OperationParser::parseOperation() (in /staging/llvm-project/build/bin/mlir-opt)
==52859==
pure virtual method called
terminate called without an active exception
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /staging/llvm-project/build/bin/mlir-opt -allow-unregistered-dialect /staging/llvm-project/mlir/test/Transforms/test-rewrite-dynamic-op.mlir -test-rewrite-dynamic-op
#0 0x000000000044d19f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/staging/llvm-project/build/bin/mlir-opt+0x34519f)
#1 0x000000000044a5f4 SignalHandler(int) Signals.cpp:0:0
#2 0x0000000004868420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x0000000004c5a00b raise /build/glibc-SzIz7B/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#4 0x0000000004c39859 abort /build/glibc-SzIz7B/glibc-2.31/stdlib/abort.c:81:7
#5 0x0000000004969911 (/lib/x86_64-linux-gnu/libstdc++.so.6+0x9e911)
#6 0x000000000497538c (/lib/x86_64-linux-gnu/libstdc++.so.6+0xaa38c)
#7 0x00000000049753f7 (/lib/x86_64-linux-gnu/libstdc++.so.6+0xaa3f7)
#8 0x0000000004976155 (/lib/x86_64-linux-gnu/libstdc++.so.6+0xab155)
#9 0x0000000001a9db7e mlir::OpBuilder::tryFold(mlir::Operation*, llvm::SmallVectorImpl<mlir::Value>&) (/staging/llvm-project/build/bin/mlir-opt+0x1995b7e)
#10 0x0000000001a291fa (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) DialectConversion.cpp:0:0
#11 0x0000000001a296a2 (anonymous namespace)::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>, llvm::function_ref<void (mlir::Diagnostic&)>) DialectConversion.cpp:0:0
#12 0x0000000001a2c4a4 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void>>*) (/staging/llvm-project/build/bin/mlir-opt+0x19244a4)
#13 0x0000000001874d77 (anonymous namespace)::TestRewriteDynamicOpDriver::runOnOperation() TestPatterns.cpp:0:0
#14 0x00000000019c3de9 mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/staging/llvm-project/build/bin/mlir-opt+0x18bbde9)
#15 0x00000000019c44a1 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/staging/llvm-project/build/bin/mlir-opt+0x18bc4a1)
#16 0x00000000019c30c5 mlir::detail::OpToOpPassAdaptor::runOnOperationAsyncImpl(bool) (/staging/llvm-project/build/bin/mlir-opt+0x18bb0c5)
#17 0x00000000019c3abd mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/staging/llvm-project/build/bin/mlir-opt+0x18bbabd)
#18 0x00000000019c44a1 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/staging/llvm-project/build/bin/mlir-opt+0x18bc4a1)
#19 0x00000000019c503c mlir::PassManager::run(mlir::Operation*) (/staging/llvm-project/build/bin/mlir-opt+0x18bd03c)
#20 0x00000000019b5293 performActions(llvm::raw_ostream&, bool, bool, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, bool, bool) (.constprop.0) MlirOptMain.cpp:0:0
#21 0x00000000019b599f processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, bool, bool, bool, bool, bool, bool, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, llvm::ThreadPool*) MlirOptMain.cpp:0:0
#22 0x00000000019b5be9 mlir::LogicalResult llvm::function_ref<mlir::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>>, llvm::function_ref<mlir::LogicalResult (mlir::PassManager&)>, mlir::DialectRegistry&, bool, bool, bool, bool, bool, bool, bool)::'lambda'(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>(long, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&) MlirOptMain.cpp:0:0
#23 0x0000000001a68547 mlir::splitAndProcessBuffer(std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::function_ref<mlir::LogicalResult (std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, llvm::raw_ostream&)>, llvm::raw_ostream&, bool, bool) (/staging/llvm-project/build/bin/mlir-opt+0x1960547)
#24 0x00000000019b463a mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::PassPipelineCLParser const&, mlir::DialectRegistry&, bool, bool, bool, bool, bool, bool, bool, bool) (/staging/llvm-project/build/bin/mlir-opt+0x18ac63a)
#25 0x00000000019b60e5 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&, bool) (/staging/llvm-project/build/bin/mlir-opt+0x18ae0e5)
#26 0x00000000004145fd main (/staging/llvm-project/build/bin/mlir-opt+0x30c5fd)
#27 0x0000000004c3b083 __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:342:3
#28 0x00000000004294de _start (/staging/llvm-project/build/bin/mlir-opt+0x3214de)
==52859==
==52859== Process terminating with default action of signal 6 (SIGABRT): dumping core
==52859== at 0x4C5A00B: raise (raise.c:51)
==52859== by 0x4C3992D: abort (abort.c:100)
==52859== by 0x4969910: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
==52859== by 0x497538B: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
==52859== by 0x49753F6: std::terminate() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
==52859== by 0x4976154: __cxa_pure_virtual (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
==52859== by 0x1A9DB7D: mlir::OpBuilder::tryFold(mlir::Operation*, llvm::SmallVectorImpl<mlir::Value>&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A291F9: (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A296A1: (anonymous namespace)::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>, llvm::function_ref<void (mlir::Diagnostic&)>) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1A2C4A3: mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void> >*) (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x1874D76: (anonymous namespace)::TestRewriteDynamicOpDriver::runOnOperation() (in /staging/llvm-project/build/bin/mlir-opt)
==52859== by 0x19C3DE8: mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (in /staging/llvm-project/build/bin/mlir-opt)
==52859==
==52859== HEAP SUMMARY:
==52859== in use at exit: 902,302 bytes in 5,158 blocks
==52859== total heap usage: 7,649 allocs, 2,491 frees, 1,443,347 bytes allocated
==52859==
==52859== LEAK SUMMARY:
==52859== definitely lost: 0 bytes in 0 blocks
==52859== indirectly lost: 0 bytes in 0 blocks
==52859== possibly lost: 144 bytes in 1 blocks
==52859== still reachable: 902,158 bytes in 5,157 blocks
==52859== suppressed: 0 bytes in 0 blocks
==52859== Rerun with --leak-check=full to see details of leaked memory
==52859==
==52859== For lists of detected and suppressed errors, rerun with: -s
==52859== ERROR SUMMARY: 5 errors from 5 contexts (suppressed: 0 from 0)
Aborted (core dumped)
@llvm/issue-subscribers-mlir
Do you have a test that would work without -allow-unregistered-dialect
? This option is really not "safe" or recommended to use in any production use-case (because it is hard to keep invariants of the system consistent, as you saw here).
no, -allow-unregistered-dialect
is necessary to reproduce the issue. the issue is caused by parsing in unregistered dialect and then loading the dialect later on causing the delete of the earlier operation impl that is still pointed to by other objects. In the RegisteredOperationName::insert()
:
// Insert the operation info if it doesn't exist yet.
auto it = ctxImpl.operations.insert({name, nullptr});
it.first->second = std::move(ownedImpl);
If -allow-unregistered-dialect is not important, then feel free to deprioritize this issue
Loading an unregistered dialect as an dependent dialect of a pass used to work. but it is broken (i.e. segfaults) as of this commit: 0441272c4501 Revert "Revert "Refactor OperationName to use virtual tables for dispatch (NFC)""
to reproduce, just comment out registering of TestDialect in
mlir-opt.cpp
:then run the
test-rewrite-dynamic-op.mlir
test:This reproduces the bug because the pass "test-rewrite-dynamic-op" declares TestDialect as a dependent dialect. So if TestDialect is not registered, the pass will cause TestDialect to be loaded after parsing. This works in prior commits than 0441272c4501
but as of commit 0441272c4501, this segfaults.