================
@@ -282,22 +282,15 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
 
   cir::LoadOp createLoad(mlir::Location loc, Address addr,
                          bool isVolatile = false) {
-    mlir::IntegerAttr align;
-    uint64_t alignment = addr.getAlignment().getQuantity();
-    if (alignment)
-      align = getI64IntegerAttr(alignment);
+    mlir::IntegerAttr align = getAlignmentAttr(addr.getAlignment());
     return create<cir::LoadOp>(loc, addr.getPointer(), /*isDeref=*/false,
                                align);
   }
 
   cir::StoreOp createStore(mlir::Location loc, mlir::Value val, Address dst,
-                           ::mlir::IntegerAttr align = {}) {
-    if (!align) {
-      uint64_t alignment = dst.getAlignment().getQuantity();
-      if (alignment)
-        align = mlir::IntegerAttr::get(mlir::IntegerType::get(getContext(), 
64),
-                                       alignment);
-    }
+                           mlir::IntegerAttr align = {}) {
+    if (!align)
----------------
andykaylor wrote:

This could be further improved by using std::optional for the `align` parameter.

https://github.com/llvm/llvm-project/pull/141830
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to