<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/128308>128308</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [MLIR]`-test-bytecode-roundtrip=test-kind=2` triggers Assertion Failure `succeeded( ConcreteT::verifyInvariants(getDefaultDiagnosticEmitFn(ctx), args...))'
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            mlir
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          xisang0
      </td>
    </tr>
</table>

<pre>
    Test on commit: https://github.com/llvm/llvm-project/commit/47928ab16b675c17826ada16f23aa0569e93a474
steps to reproduce:
```
mlir-opt test.mlir -test-bytecode-roundtrip=test-kind=2
```
test case:
```
module {
 func.func @main() -> () {
    %cst = arith.constant dense<42> : vector<3xi32>
    return
  }
}
```
crash trace:
```
Overriding parsing of TestI32Type encoding...
<unknown>:0: error: failed to verify 'elementType': integer or index or floating-point
<unknown>:0: note: in bytecode version 6 produced by: MLIR20.0.0git
mlir-opt: /home/workdir/llvm-project-19/mlir/include/mlir/IR/StorageUniquerSupport.h:180: static ConcreteT mlir::detail::StorageUserBase<mlir::VectorType, mlir::Type, mlir::detail::VectorTypeStorage, mlir::detail::TypeUniquer, mlir::ShapedType::Trait, mlir::ValueSemantics>::get(MLIRContext *, Args &&...) [ConcreteT = mlir::VectorType, BaseT = mlir::Type, StorageT = mlir::detail::VectorTypeStorage, UniquerT = mlir::detail::TypeUniquer, Traits = <mlir::ShapedType::Trait, mlir::ValueSemantics>, Args = <llvm::ArrayRef<long> &, mlir::Type &, llvm::ArrayRef<bool> &>]: Assertion `succeeded( ConcreteT::verifyInvariants(getDefaultDiagnosticEmitFn(ctx), args...))' 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 -test-bytecode-roundtrip=test-kind=2
 #0 0x000061cc539e59b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./mlir-opt+0x107f9b8)
 #1 0x000061cc539e34de llvm::sys::RunSignalHandlers() (./mlir-opt+0x107d4de)
 #2 0x000061cc539e63c8 SignalHandler(int) Signals.cpp:0:0
 #3 0x00007a32b865d520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007a32b86b19fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007a32b865d476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007a32b86437f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00007a32b864371b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x00007a32b8654e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x000061cc56dc8b3c (./mlir-opt+0x4462b3c)
#10 0x000061cc56dc89a8 mlir::VectorType::get(llvm::ArrayRef<long>, mlir::Type, llvm::ArrayRef<bool>) (./mlir-opt+0x44629a8)
#11 0x000061cc56dc4fef (anonymous namespace)::BuiltinDialectBytecodeInterface::readType(mlir::DialectBytecodeReader&) const BuiltinDialectBytecode.cpp:0:0
#12 0x000061cc56b6e605 std::unique_ptr<mlir::AttrTypeBytecodeReader<mlir::Type>, std::default_delete<mlir::AttrTypeBytecodeReader<mlir::Type>>> mlir::AttrTypeBytecodeReader<mlir::Type>::fromCallable<(anonymous namespace)::TestBytecodeRoundtripPass::runTest2(mlir::Operation*)::'lambda'(mlir::DialectBytecodeReader&, llvm::StringRef, mlir::Type&), true>((anonymous namespace)::TestBytecodeRoundtripPass::runTest2(mlir::Operation*)::'lambda'(mlir::DialectBytecodeReader&, llvm::StringRef, mlir::Type&)&&)::Processor::read(mlir::DialectBytecodeReader&, llvm::StringRef, mlir::Type&) TestBytecodeRoundtrip.cpp:0:0
#13 0x000061cc58d5ae01 (anonymous namespace)::AttrTypeReader::resolveType(unsigned long) BytecodeReader.cpp:0:0
#14 0x000061cc58d59ad7 (anonymous namespace)::DialectReader::readType(mlir::Type&) BytecodeReader.cpp:0:0
#15 0x000061cc56dc6864 llvm::LogicalResult mlir::DialectBytecodeReader::readType<mlir::ShapedType>(mlir::ShapedType&) (./mlir-opt+0x4460864)
#16 0x000061cc56dc3f8b (anonymous namespace)::BuiltinDialectBytecodeInterface::readAttribute(mlir::DialectBytecodeReader&) const BuiltinDialectBytecode.cpp:0:0
#17 0x000061cc58d5a6a4 (anonymous namespace)::AttrTypeReader::resolveAttribute(unsigned long) BytecodeReader.cpp:0:0
#18 0x000061cc58d59a37 (anonymous namespace)::DialectReader::readAttribute(mlir::Attribute&) BytecodeReader.cpp:0:0
#19 0x000061cc53c20c74 llvm::LogicalResult mlir::DialectBytecodeReader::readAttribute<mlir::TypedAttr>(mlir::TypedAttr&) (./mlir-opt+0x12bac74)
#20 0x000061cc53c20c18 mlir::arith::ConstantOp::readProperties(mlir::DialectBytecodeReader&, mlir::OperationState&) (./mlir-opt+0x12bac18)
#21 0x000061cc58d57388 mlir::BytecodeReader::Impl::parseRegions(std::vector<mlir::BytecodeReader::Impl::RegionReadState, std::allocator<mlir::BytecodeReader::Impl::RegionReadState>>&, mlir::BytecodeReader::Impl::RegionReadState&) (./mlir-opt+0x63f1388)
#22 0x000061cc58d52d9b mlir::BytecodeReader::Impl::parseIRSection(llvm::ArrayRef<unsigned char>, mlir::Block*) (./mlir-opt+0x63ecd9b)
#23 0x000061cc58d501fd mlir::BytecodeReader::Impl::read(mlir::Block*, llvm::function_ref<bool (mlir::Operation*)>) (./mlir-opt+0x63ea1fd)
#24 0x000061cc58d58b7e readBytecodeFileImpl(llvm::MemoryBufferRef, mlir::Block*, mlir::ParserConfig const&, std::shared_ptr<llvm::SourceMgr> const&) BytecodeReader.cpp:0:0
#25 0x000061cc58d58a0e mlir::readBytecodeFile(llvm::MemoryBufferRef, mlir::Block*, mlir::ParserConfig const&) (./mlir-opt+0x63f2a0e)
#26 0x000061cc56c9bfbf mlir::parseSourceFile(llvm::SourceMgr const&, mlir::Block*, mlir::ParserConfig const&, mlir::LocationAttr*) (./mlir-opt+0x4335fbf)
#27 0x000061cc56c9c658 mlir::parseSourceString(llvm::StringRef, mlir::Block*, mlir::ParserConfig const&, llvm::StringRef, mlir::LocationAttr*) (./mlir-opt+0x4336658)
#28 0x000061cc56b6db44 (anonymous namespace)::TestBytecodeRoundtripPass::doRoundtripWithConfigs(mlir::Operation*, mlir::BytecodeWriterConfig const&, mlir::ParserConfig const&) TestBytecodeRoundtrip.cpp:0:0
#29 0x000061cc56b6b980 (anonymous namespace)::TestBytecodeRoundtripPass::runOnOperation() TestBytecodeRoundtrip.cpp:0:0
#30 0x000061cc56c9f08f mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (./mlir-opt+0x433908f)
#31 0x000061cc56c9f872 mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (./mlir-opt+0x4339872)
#32 0x000061cc56ca201e mlir::PassManager::run(mlir::Operation*) (./mlir-opt+0x433c01e)
#33 0x000061cc56c9ab3b performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#34 0x000061cc56c9a79b 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
#35 0x000061cc56d44f25 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+0x43def25)
#36 0x000061cc56c95682 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (./mlir-opt+0x432f682)
#37 0x000061cc56c95933 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x432f933)
#38 0x000061cc56c95b42 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (./mlir-opt+0x432fb42)
#39 0x000061cc539c4bd7 main (./mlir-opt+0x105ebd7)
#40 0x00007a32b8644d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#41 0x00007a32b8644e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#42 0x000061cc539c4745 _start (./mlir-opt+0x105e745)
Aborted (core dumped)
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzcWt9v46j2_2voC2qEwT8f-pC2E30rzWiqdr67jxUG7HDrgC_g2fa_v8J2Yse1m6a7s1d3R9HUMZzD5_w-EKi1slRCXIHoGkS3F7RxW22uXqSlqkQXueavVz-EdVAryPRuJx0ga7h1rraArAHeALwppds2-YrpHcCbqvq5_3NZG_0vwRzAm54Ub8IkwynNgziPk4gFSYpjymkQF5hQiqI4ExmhYRICtLZO1BY6DY2ojeYNE35FtAYx6j9ovaukudS1g05Yt_Lf4KV_vMxfnWCai0ujG8WdkTUgt-3Is1QckFs84eTHIKN2bhHNm0pAkFwDtIZFo9jK_wd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