[Mlir-commits] [mlir] [mlir] Introduce AlignmentAttrOpInterface to expose MaybeAlign (PR #161440)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sat Oct 4 15:27:27 PDT 2025


jiang1997 wrote:

Hi @amd-eochoalo,
While grepping for remaining alignment uses, I noticed that most of the call sites aren't the op constructors themselves (as mentioned [here](https://github.com/llvm/llvm-project/pull/159449#pullrequestreview-3272425003)), but rather the various lowering/transform passes that extract alignment using getAlignment() directly. For example:

- [`mlir/lib/Conversion/MemRefToEmitC/MemRefToEmitC.cpp`](https://github.com/llvm/llvm-project/blob/7de73c4e9d5ee1ec00bb57427ac04746ce858c3c/mlir/lib/Conversion/MemRefToEmitC/MemRefToEmitC.cpp#L75-L261)
- [`mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp`](https://github.com/llvm/llvm-project/blob/7de73c4e9d5ee1ec00bb57427ac04746ce858c3c/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp#L170-L966)
- [`mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp`](https://github.com/llvm/llvm-project/blob/7de73c4e9d5ee1ec00bb57427ac04746ce858c3c/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp#L529-L535)
- [`mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp`](https://github.com/llvm/llvm-project/blob/7de73c4e9d5ee1ec00bb57427ac04746ce858c3c/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp#L942-L948)
- [`mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp`](https://github.com/llvm/llvm-project/blob/7de73c4e9d5ee1ec00bb57427ac04746ce858c3c/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp#L743-L809)
- [`mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp`](https://github.com/llvm/llvm-project/blob/7de73c4e9d5ee1ec00bb57427ac04746ce858c3c/mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp#L185-L232)
- [`mlir/lib/Dialect/MemRef/Transforms/EmulateWideInt.cpp`](https://github.com/llvm/llvm-project/blob/7de73c4e9d5ee1ec00bb57427ac04746ce858c3c/mlir/lib/Dialect/MemRef/Transforms/EmulateWideInt.cpp#L43-L48)
- [`mlir/lib/Dialect/MemRef/Transforms/ExpandRealloc.cpp`](https://github.com/llvm/llvm-project/blob/7de73c4e9d5ee1ec00bb57427ac04746ce858c3c/mlir/lib/Dialect/MemRef/Transforms/ExpandRealloc.cpp#L100-L108)
- [`mlir/lib/Dialect/MemRef/Transforms/FlattenMemRefs.cpp`](https://github.com/llvm/llvm-project/blob/7de73c4e9d5ee1ec00bb57427ac04746ce858c3c/mlir/lib/Dialect/MemRef/Transforms/FlattenMemRefs.cpp#L125-L136)
- [`mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp`](https://github.com/llvm/llvm-project/blob/7de73c4e9d5ee1ec00bb57427ac04746ce858c3c/mlir/lib/Dialect/SPIRV/IR/SPIRVDialect.cpp#L51-L201)
- [`mlir/lib/Dialect/Vector/Transforms/LowerVectorGather.cpp`](https://github.com/llvm/llvm-project/blob/7de73c4e9d5ee1ec00bb57427ac04746ce858c3c/mlir/lib/Dialect/Vector/Transforms/LowerVectorGather.cpp#L68-L209)

Do you think those call sites should also migrate to getMaybeAlign() as part of this cleanup, or should we keep this change scoped strictly to the constructor signatures for now?


https://github.com/llvm/llvm-project/pull/161440


More information about the Mlir-commits mailing list