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

    <tr>
        <th>Summary</th>
        <td>
            @Mogball Fold operations are missing/not working for `index` in the `index` dialect.
        </td>
    </tr>

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

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

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

<pre>
    Attention to: @Mogball 

This is a follow-up of the ticket raised [here](https://github.com/llvm/llvm-project/blob/61757fbd048fc0eae0b61b7cb14001e27f0becd0/mlir/include/mlir/Dialect/Index/IR/IndexOps.td#L449) on Mojo's Github repo.

```
array3.mojo:13:64: note: failed to fold operation index.castu(4 : index)
         value: __mlir_op.`index.castu`[_type: __mlir_type.ui8](value_as_index)
```

The error message shows that fold operation has failed for unsigned casting to inbuilt type `ui8` from type `index`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUU0FvnDwQ_TXmMgoajNfAgcNGKz59UqNKVe8rAwM4MRjZJtv995XZbrPJrQhhzWAe7z3PU97rcSGq2eGZHU6J2sJkXf16nbtpGZPW9tf6GAItQdsFgmX5EZjAFzu2yhhgeGJ4vD1_TtqD9qBgsMbYy9O2gh0gTARBd28UwCntqQd2eJ7IETucGC-nEFbP8iPjDePNqMO0tWlnZ8YbY97vy9Pq7Ct1gfGmNbZlvJFZcSiGtkdRDh2SImxl1hZdmwnEjHgxYEtdj4w3s9GO8UYvndl6-mictDI3zP-Xnn7F9ce9-L76NPSM59-EqBivwC7wYl8t44WH_3aW4Gi16aMDTOKfey-Vc-qap3P8LD9mOcuPUkQDFxsoroPShnoINjrWg13Jqd1nHSmknfJhY7wUEDfrG8fqhg33612ZbQc7n6Oss11TJvERQCI7PJ_DdX3cFst00-XtEHaQs_Lnzz_5oud-zATknHUwk_dqJPCTvXgIkwpfdUzK30UO1sG27MPWQySmlzEq10u7aRMgEgImMXKSCIOz89_ejZXENOnrvK_ySiVUZ7ISRYaVFMlUly2XSBx5K6p8kGXeDaXIuRz6oacOs0TXHHmOVSayArnAlJdYKkXUFarsEEsmkGalTRrHLbVuTLT3G9VSCuSJUS0Zv4eE84UusL9knMfMuHof0XYbPRNotA_-AyXoYKh-iEzzySIPyhHM2nu9jIw3iw1wse4tuhMte1APetnD9NjqbyOcJpsz9T9HaRfhY5iiyN8BAAD__2fLRo8">