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

    <tr>
        <th>Summary</th>
        <td>
            [MLIR]`-convert-spirv-to-llvm` failed to legalize operation 'spirv.Constant'
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    I encountered an error when using `-convert-spirv-to-llvm` pass.`%1` can be lowered, but failed to lower ` %cst`. 
How to deal with `spirv.Constant`  with !spirv.array<6 x i32>?


Test on commit: #[6740991](https://github.com/llvm/llvm-project/tree/67409911353323ca5edf2049ef0df54132fa1ca7)
Steps to reproduce:
```
mlir-opt test.mlir -convert-func-to-spirv -convert-spirv-to-llvm
```
Test case:
```
module {
  func.func @main() {
    %cst = spirv.Constant dense<[92, 46, 90, 96, 101, 50]> : tensor<6xi32> : !spirv.array<6 x i32>
    %1 = spirv.Constant false
 return
  }
}
```
Error message:
```
test.mlir:3:12: error: failed to legalize operation 'spirv.Constant' that was explicitly marked illegal
    %cst = spirv.Constant dense<[92, 46, 90, 96, 101, 50]> : tensor<6xi32> : !spirv.array<6 x i32>
           ^
test.mlir:3:12: note: see current operation: %0 = "spirv.Constant"() {value = dense<[92, 46, 90, 96, 101, 50]> : tensor<6xi32>} : () -> !spirv.array<6 x i32>
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVc1u4zYQfprRZWCDIvUTHXSI4xhdoL20PfVGUSObLUUKJBUnffqClJtkF5stFuhhDYPkYMbz830zYxmCPluiHuoD1MdCrvHifH8gaf6g5fLii8GNL_0nJKvcaiN5GlFaJO-dx-uFLK5B2zNCw3bK2SfycRcW7Z920e2MeZqhYbjIEPbQMOB1mWQlLQ6Exl2TP-APOKwRJ6kNjRjdpkguEXitQoSG7RHYEdj9T-6aLEaSBq86XpJVjrd_cDZEaZMx3lS83FTSe_kC4qHBZ9SCg3gEcdr8vT9_pxDRWVRunnUEcY_ABdSHpq1Y15VQH4HfXWJcAoh74Cfgp7OOl3XYKzcDP-Vyt2u3ePcnqQj8FD0R8NPNSSlqIbhQsqZx4qzqaGLjVFel4JMslWyBd1s2v0VaQqrV0-LduCpKUbd0G3b7ZnE22u_cEjFSiPsk4SsX02pVoiIDgR9Q9DWnGQwlw8dR3bgaQmgPm4yYYu3TgVCxWWoL_A54994Eb4wiiCN-zhuOZFO0B6gPHU9NUTXp7Fg-87tkZbpqlrgQj5g4imSD84nd541b3Jj7mPv3uZRfy2SSJtDNzFNcvf33N9Aeb2C8Pj5H5TEPxkwhyPOH0L3yBOJegLgveUo5z1R6vBsEOkuj_yZ0C3kZtbMIvP2i33mL8SIjXmVAel6MVjqaF5yl_4tG1CY7-TEJuH2gfvwWMNbFBCUGIlSr92TjGyBbrJrlgoDzL8Hhb034JM1K2e7_qhTa463YHGOXDf-r8NdmKMZejJ3oZEF92bRty6uSN8Wlr0RbDe04iEm2VKupVF078qHixGmqR1nonjMumGCccX5X1XvFmkG1Sk5iVN3QCagYzVKbfZrvvfPnQoewUt-UJesKIwcyIe98zi1dMSsTVvWx8H1eYMN6DlAxo0MMb16ijib_Wfzy86dfEzLfWvvf3cfF6k3_3Qs2Jx_Sik3F_RMAAP__mAD9tw">