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

    <tr>
        <th>Summary</th>
        <td>
            [MLIR]Convert tensor to SPIRV pass triggers error "failed to materialize conversion"
        </td>
    </tr>

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

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

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

<pre>
    Reproduced with:
mlir-opt -convert-tensor-to-spirv  test.mlir

test case:
```
module {
 func.func @main() {
    %cst_0 = arith.constant dense<[1,1]> : tensor<2xi32>
    %11 = bufferization.to_memref %cst_0 : memref<2xi32>
 return
  }
}
```
error message:
```
test.mlir:4:14: error: failed to materialize conversion for result #0 of operation 'arith.constant' that remained live after conversion
    %cst_0 = arith.constant dense<true> : tensor<1xi1>
 ^
test.mlir:4:14: note: see current operation: %1 = "arith.constant"() {value = dense<true> : tensor<1xi1>} : () -> tensor<1xi1>
test.mlir:5:11: note: see existing live user here: %2 = "bufferization.to_memref"(%1) : (tensor<1xi1>) -> memref<1xi1>
    %11 = bufferization.to_memref %cst_0 : memref<1xi1>
          ^
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVF2PqzYQ_TXDyygR2HEIDzxkl410pVaqtlJfrwwewBXgyB6y2_vrK0N2sx_dfqhR5BA8c3zOmRnrEGw3EZWg7kBViZ65d74MT0TaJLUzf5SPdPbOzA0ZfLLcgzxCWkF6HAfrN-7MuGncdCHPG6YpOL9htwln6y-ITIG3MW7NWNf4Ehsd6BUJ9un1uwI7Mw-EkN-t_7Gdp2YbF4RdOmo7gTiAKN5EICII1QT-niLICrW33G8bNwXWE6OhKR53D-ouA3GfgapAPiDII66cQd6LZysFyId3iFm2wNVz25K3PzRbN23ZfR9p9NS-PfOI67vPSJ549tMLLOTVVfTrw3v15L3zOFIIuvvSopux8rgDeczigktqfGi1HcggOxw1k7d6sD8I1zIF6yZsnUdPYR4YQcgUXYvuTH7RhyDy9_6ByJF7zegpuk8GB3sh1C2Tf4P632rBfqZPRciebXZzDtTD38mdHEeDMBBhM3tPE99UxI1YwIUCCPFRkbj10EUPMy1x_4pbXuEKvuRvYtxf83_LWkXW2UfW9GwD26lb_ZwDeezJ05W7eOH-Rfu9iFDZImTl9InKC8fX9nzv8f_o809A6-e1ah96NjGlNIUsdEJlts9zVezlQSZ9We_pIHK114U6GNWatG1Im5xy09YiF2liS5EKmQpxyHaq2Mlt3RZFW5DOC3MwtGthl8bOHLbDcBm3zneJDWGmcp-lqkgGXdMQlhtOiImecNmM7qkq8WXM2dRzF2CXDjZwuKGw5WG5Gn_-6dsjqOp-veiu9Y7z9esv3x5_w7MOAdnbriMf1jGMdfunMQQhktkPZc98DnHUxQnEqbPcz_W2cSOIU6Ry_dmcvfudGgZxWgQEEKdF4J8BAAD__2jHuu4">