<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60484>60484</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[mlir] Fix inconsistency between values defined as `index` and their attribute counterpart as `i64`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
qcolombet
</td>
</tr>
</table>
<pre>
Filing this issue to remember to fix what we discussed in https://discourse.llvm.org/t/rfc-inconsistency-between-dynamic-and-static-attributes-i64-v-index/66612.
In a nutshell the problem is that some operation supports both dynamic and static attributes as inputs and depending on which one you set you get a different type: `index` or `i64`.
E.g.,
```
def MemRef_ReinterpretCastOp
: MemRef_OpWithOffsetSizesAndStrides<"reinterpret_cast", [
[...]
let arguments = (ins Arg<AnyRankedOrUnrankedMemRef, "", []>:$source,
[...]
Variadic<Index>:$sizes, // <-- dynamic sizes (index)
[...]
I64ArrayAttr:$static_sizes, // <-- static sizes (i64)
```
To workaround this issue, we have to do some gymnastic to make sure we get the same type regardless of how the attribute was set to beginning with. E.g., https://github.com/llvm/llvm-project/blob/ed740e741ec22f9aaea09bfc0b87d0801a7c492f/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp#L170
@chelini made the first step toward fixing that in a9733b8a5eed441d6378d0fc88630233e00a6395 (replacing `I64ArrayAttr` with `DenseI64ArrayAttr`).
We still have to do the switch from `i64` to `index`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVU2P4ygQ_TXkUopF8EfiQw6ZZCK1tKuWenZ3jiMMZZsdG7xQ7kz216_A6aR7NJeNIhtc8IqqevWQIZjOIu5Z-YmVp5WcqXd-_49ygxsbpFXj9HV_NoOxHVBvApgQZgRy4HHEsUEfx635AZdeElwQtAlqDgE1GAs90RRYfmDizMQ5mtzsA2bD8DpmzndMnImJs2_V2ljlbDCB0KrrukG6INq1vlo5GrWWVq8DS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