[Mlir-commits] [mlir] [mlir] Fix MemRefType alignment in ConvertVectorToLLVM (PR #137389)

Andrzej WarzyƄski llvmlistbot at llvm.org
Wed Apr 30 12:24:30 PDT 2025


================
@@ -278,9 +313,17 @@ class VectorGatherOpConversion
 
     // Resolve alignment.
     unsigned align;
-    if (failed(getMemRefAlignment(*getTypeConverter(), memRefType, align))) {
-      return rewriter.notifyMatchFailure(gather,
-                                         "could not resolve memref alignment");
+    if (useVectorAlignment) {
+      if (failed(getVectorAlignment(*this->getTypeConverter(), vType, align))) {
+        return rewriter.notifyMatchFailure(
+            gather, "could not resolve vector alignment");
+      }
+    } else {
+      if (failed(getMemRefAlignment(*this->getTypeConverter(), memRefType,
+                                    align))) {
+        return rewriter.notifyMatchFailure(
+            gather, "could not resolve memref alignment");
+      }
----------------
banach-space wrote:

Similar code is repeated twice - could this be moved to a dedicated helper? I would prioritise making the API self-documenting :) (e.g. `getVectorToLLVMAlignment(Operation *op, useVectorAlignment, align)` or something similar).

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


More information about the Mlir-commits mailing list