[Mlir-commits] [mlir] [MLIR][MemRef] Complete alignment type migration in OpBuilders (PR #159449)
Erick Ochoa Lopez
llvmlistbot at llvm.org
Fri Sep 26 06:52:28 PDT 2025
================
@@ -1237,28 +1237,28 @@ def LoadOp : MemRef_Op<"load",
OpBuilder<(ins "Value":$memref,
"ValueRange":$indices,
CArg<"bool", "false">:$nontemporal,
- CArg<"uint64_t", "0">:$alignment), [{
+ CArg<"llvm::MaybeAlign", "llvm::MaybeAlign()">:$alignment), [{
return build($_builder, $_state, memref, indices, nontemporal,
- alignment != 0 ? $_builder.getI64IntegerAttr(alignment) :
- nullptr);
+ alignment ? $_builder.getI64IntegerAttr(alignment.valueOrOne().value()) :
----------------
amd-eochoalo wrote:
One can't do that but can do:
```suggestion
alignment ? $_builder.getI64IntegerAttr((*alignment).value()) :
```
or also
```suggestion
alignment ? $_builder.getI64IntegerAttr(alignment->value()) :
```
because `MaybeAlign` inherits from `std::optional` and calling `value` will return an `llvm::Align`
I think the second one here is better.
https://github.com/llvm/llvm-project/pull/159449
More information about the Mlir-commits
mailing list