<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/155677>155677</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Refactor alignment attributes to use `llvm::MaybeAlign` and the `IntValidAlignment` constraint
</td>
</tr>
<tr>
<th>Labels</th>
<td>
good first issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
amd-eochoalo
</td>
</tr>
</table>
<pre>
[The `IntValidAlignment` constraint](https://github.com/llvm/llvm-project/pull/155259) is currently being used in the vector dialect to verify that the alignment is a positive integer power of two. The memref and SPIR-V dialects also contain operations which denote the alignment of memory operations, however they do not yet use the `IntValidAlignment` constraint.
After modifying the memory operations in the memref and SPIR-V dialects to use the `IntValidAlignment` constraint, one can also create constructors for these operations which take an instance of `llvm::MaybeAlign` as an optional parameter similar to how constructors in the vector dialect are defined here:
https://github.com/llvm/llvm-project/blob/a3eb311ad3769789ced18cc4f0fba31f04293045/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td#L1726-L1734
Finally, one improvement that can be made to all three dialects is to create an interface which returns an `llvm::MaybeAlign` as opposed to an `std::optional<uint64_t>`. It could be named `getMaybeAlign`.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVN1u6zYMfhrlhmhgy_8XvshOZ6DAGTZ0Q28H2qJjbbJkSHQCv_0gpzldt6E7vQpi0_z4_ZAYgj5bolYUP4ji8YArT863OKsHcsPk0LhD79QW3_82EYgyebL8gkark9FnO5NlUSYwOBvYo7Ysikch64l5CSI7CdkJ2Z01T2t_HNwsZGfM5f7zsHj3Bw0sZLesxgjZpUUhi0bIBnSAYfWeLJsNetL2DGsgBdoCTwQXGth5UBoNDQzs4EJejxvwhLxX4H2-2AphcUGzvhBoy3QmD4u7kgc3Al_dESK5mWZPI6BV8OsvT88PL_f2AdAEF0kyagtuIY-snQ1wnfQwgSLrmP6B6sbY0Pntb_VCfoHJXelCPlZvoBxYx7ARR3Z7h_-X-AgiOYnkdBqZPMxO6XGL-vCNw3vIu2AfkGP3CfBIwVmCAe2rKp6Q6bVija4EGN3OL9C_tWL8kwAtaBsY7UBRJ1Emeyqyk8hOP-HW0w4egTHEYrfEFmhgQY8zRdpBz9qgj8NP7voe_r8zgp5A0agtKZjIU4Tbdfx0WHvjeiE7zKjP0hRVVpVNVTcDqbQehnxMxh6zdExy2WRJXgjZzUZ7ITttB7MqenvweJtNyO5lH1bI7un527-fl3BkJWT2Na1k-fA1rbL8NnKnLRqz3c3Q8-Ldhfbc7QsQ3ekJZlQUFUJjgCdP9Ga63n1_NW_3g8mPONCrT5549XZX_2N73LK4uJgRZq8NrG6ld9dE9mXVlsv8dxbZj6JMjvDEMLjVqDikxZlU_PBM_K778aDaTDVZgwdq06ooM5kmaX2Y2iwv01wqHBuS6Uh1XjaVahJZllVR1BkddCsTWSS1rNK6KIv6WAyjGussTWVRp5j0Ik9oRm2OkdnR-fNBh7BSmxZFWVUHgz2ZsF9FKc_OKRi1D_GUhJWElPFW-naPRb-eg8gTowOHt26s2VD7TCPuGXw7C8jsdb8yfdu7j-S16jvX8rB60346yDudcLu7kfallX8FAAD__8s3Dcg">