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

    <tr>
        <th>Summary</th>
        <td>
            [mlir] --convert-tensor-to-spirv crashed in mlir::tensor::SplatOp::fold with assertion failure "expected integer attribute type to equal element type".
        </td>
    </tr>

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

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

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

<pre>
    git version: e9c6f3f5e7e23b23de4eeaa182ebfcb7d2188495

system: ```Ubuntu 20.04.6 LTS (Focal Fossa)```

reproduced with: ```mlir-opt --convert-tensor-to-spirv a.mlir```

a.mlir:
```
%24 = llvm.mlir.constant(1 : index) : i64
%splat_14 = tensor.splat %24 : tensor<17xi64>
```


trace:
```
mlir-opt: /data/bin/llvm-project/mlir/lib/IR/BuiltinAttributes.cpp:961: static mlir::DenseElementsAttr mlir::DenseElementsAttr::get(mlir::ShapedType, llvm::ArrayRef<mlir::Attribute>): Assertion `intAttr.getType() == eltType && "expected integer attribute type to equal element 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: /data/bin/llvm-project/build/bin/mlir-opt --convert-tensor-to-spirv a.mlir
 #0 0x000055a0f3b3be6f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/data/bin/llvm-project/build/bin/mlir-opt+0x1640e6f)
 #1 0x000055a0f3b38ec4 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f805fac0420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x00007f805f5ab00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #4 0x00007f805f58a859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #5 0x00007f805f58a729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #6 0x00007f805f59bfd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #7 0x000055a0f6917e51 mlir::DenseElementsAttr::get(mlir::ShapedType, llvm::ArrayRef<mlir::Attribute>) (/data/bin/llvm-project/build/bin/mlir-opt+0x441ce51)
 #8 0x000055a0f58bfcff mlir::tensor::SplatOp::fold(mlir::tensor::SplatOpGenericAdaptor<llvm::ArrayRef<mlir::Attribute>>) (/data/bin/llvm-project/build/bin/mlir-opt+0x33c4cff)
 #9 0x000055a0f5858f36 mlir::LogicalResult llvm::detail::UniqueFunctionBase<mlir::LogicalResult, mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&>::CallImpl<mlir::Op<mlir::tensor::SplatOp, mlir::OpTrait::ZeroRegions, mlir::OpTrait::OneResult, mlir::OpTrait::OneTypedResult<mlir::RankedTensorType>::Impl, mlir::OpTrait::ZeroSuccessors, mlir::OpTrait::OneOperand, mlir::OpTrait::OpInvariants, mlir::OpAsmOpInterface::Trait, mlir::ConditionallySpeculatable::Trait, mlir::OpTrait::AlwaysSpeculatableImplTrait, mlir::MemoryEffectOpInterface::Trait>::getFoldHookFn()::'lambda'(mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) const>(void*, mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/bin/llvm-project/build/bin/mlir-opt+0x335df36)
#10 0x000055a0f586b01d mlir::RegisteredOperationName::Model<mlir::tensor::SplatOp>::foldHook(mlir::Operation*, llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/bin/llvm-project/build/bin/mlir-opt+0x337001d)
#11 0x000055a0f69badc2 mlir::Operation::fold(llvm::ArrayRef<mlir::Attribute>, llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/bin/llvm-project/build/bin/mlir-opt+0x44bfdc2)
#12 0x000055a0f69bb108 mlir::Operation::fold(llvm::SmallVectorImpl<mlir::OpFoldResult>&) (/data/bin/llvm-project/build/bin/mlir-opt+0x44c0108)
#13 0x000055a0f68ea16a mlir::OpBuilder::tryFold(mlir::Operation*, llvm::SmallVectorImpl<mlir::Value>&) (/data/bin/llvm-project/build/bin/mlir-opt+0x43ef16a)
#14 0x000055a0f685599b (anonymous namespace)::OperationLegalizer::legalize(mlir::Operation*, mlir::ConversionPatternRewriter&) DialectConversion.cpp:0:0
#15 0x000055a0f6856457 (anonymous namespace)::OperationConverter::convertOperations(llvm::ArrayRef<mlir::Operation*>, llvm::function_ref<void (mlir::Diagnostic&)>) DialectConversion.cpp:0:0
#16 0x000055a0f68588c4 mlir::applyPartialConversion(mlir::Operation*, mlir::ConversionTarget const&, mlir::FrozenRewritePatternSet const&, llvm::DenseSet<mlir::Operation*, llvm::DenseMapInfo<mlir::Operation*, void>>*) (/data/bin/llvm-project/build/bin/mlir-opt+0x435d8c4)
#17 0x000055a0f60b51f3 (anonymous namespace)::ConvertTensorToSPIRVPass::runOnOperation() TensorToSPIRVPass.cpp:0:0
#18 0x000055a0f67ae08e mlir::detail::OpToOpPassAdaptor::run(mlir::Pass*, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int) (/data/bin/llvm-project/build/bin/mlir-opt+0x42b308e)
#19 0x000055a0f67ae56a mlir::detail::OpToOpPassAdaptor::runPipeline(mlir::OpPassManager&, mlir::Operation*, mlir::AnalysisManager, bool, unsigned int, mlir::PassInstrumentor*, mlir::PassInstrumentation::PipelineParentInfo const*) (/data/bin/llvm-project/build/bin/mlir-opt+0x42b356a)
#20 0x000055a0f67aed94 mlir::PassManager::run(mlir::Operation*) (/data/bin/llvm-project/build/bin/mlir-opt+0x42b3d94)
#21 0x000055a0f679fb03 performActions(llvm::raw_ostream&, std::shared_ptr<llvm::SourceMgr> const&, mlir::MLIRContext*, mlir::MlirOptMainConfig const&) MlirOptMain.cpp:0:0
#22 0x000055a0f67a0fd4 processBuffer(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::MlirOptMainConfig const&, mlir::DialectRegistry&, llvm::ThreadPool*) MlirOptMain.cpp:0:0
#23 0x000055a0f67a1184 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>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&)::'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
#24 0x000055a0f68a0474 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) (/data/bin/llvm-project/build/bin/mlir-opt+0x43a5474)
#25 0x000055a0f67999e7 mlir::MlirOptMain(llvm::raw_ostream&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>, mlir::DialectRegistry&, mlir::MlirOptMainConfig const&) (/data/bin/llvm-project/build/bin/mlir-opt+0x429e9e7)
#26 0x000055a0f67a12d1 mlir::MlirOptMain(int, char**, llvm::StringRef, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x42a62d1)
#27 0x000055a0f67a1736 mlir::MlirOptMain(int, char**, llvm::StringRef, mlir::DialectRegistry&) (/data/bin/llvm-project/build/bin/mlir-opt+0x42a6736)
#28 0x000055a0f3a734eb main (/data/bin/llvm-project/build/bin/mlir-opt+0x15784eb)
#29 0x00007f805f58c083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#30 0x000055a0f3b0c1ce _start (/data/bin/llvm-project/build/bin/mlir-opt+0x16111ce)
Aborted (core dumped)
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcWk1z2zjS_jX0hWUVCH4ffFDs6B1Xxa9dlmcOe1GBYFPGBgI4AJhY8-u3AFIyQcuKEnszmU0ljkk0Gv30BxrdBNGarQXARZB-CNKrM9KZR6kuiJBiu5GdvrlcnlWy3l6smQm_gNJMiiCeh1DSrImbFHLAcYXjGhIAQqICQ9XQKq9xVBRJmQboKkDz_qfeagMbOzvIUP_396oTpgsxmqFkloWfHpZhgIuFpISHC6k1CXC5Jx7zUtAqWXcU6vArM48e0w1n6ly2Jjw_p1J8AWXODQgt1bmR57pl6ktIZpboIOdhKB4epzQ4xUkYxFch5182jnRGpdCGCBPgIgqtJEzU8BTgsn_Ikv1U3XJiVlHPoJdp5t6FO77z4XUQX0b5k50bfzwsyOinUYTCaxLvtOFUhBc1MSTAi4qJAC8shvNWyX8DNQFeOOB4wVkV4MX1fYAXHzrGDRNzYxSrOgN6Rts2iOdlFll-2hDDaLhTWDy_AqHhI4cNCKPtrGNj_es1WMU9ky0fSQv1w7aFAF86Lffv50qR7T00QXz5TLwXzKoJl1amudagDJPCOgQTxpLM1mB6jkVvlitrAODuZRjgLMBZGGAMTy1QA3XIhIE1qJDs-IfGUhoZwp8d4SH0MNzbAOMA52FDGId61iv97tPH-fJjqLtqw0xIwqpbhwpaqYzl8WhMqy0AvAjwYs3MY1fNqNwMFnlpGKZ1BzrAi5AIKxzlXQ2heYSQKqIfw4rQz84JhuWXhtDPYd1t2r1XoFno_twpuVZkExK17pwlTvCLqmO83g-eHl5u4TDAMQrRE0IIpSlBTVzFFWTNyLR6q_tf7hQTxgn_4FwaF89EinxdSW0UkI0z2KU1krOm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