[llvm-branch-commits] [mlir] [mlir][memref] Check memory space before lowering alloc ops (PR #134427)

Matthias Springer via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Apr 7 00:01:46 PDT 2025


================
@@ -75,9 +75,11 @@ class ConvertToLLVMPattern : public ConversionPattern {
                              ValueRange indices,
                              ConversionPatternRewriter &rewriter) const;
 
-  /// Returns if the given memref has identity maps and the element type is
-  /// convertible to LLVM.
-  bool isConvertibleAndHasIdentityMaps(MemRefType type) const;
+  /// Returns if the given memref type is convertible to LLVM and has an
+  /// identity layout map. If `verifyMemorySpace` is set to "false", the memory
+  /// space of the memref type is ignored.
+  bool isConvertibleAndHasIdentityMaps(MemRefType type,
+                                       bool verifyMemorySpace = true) const;
----------------
matthias-springer wrote:

Done.

I added it because it is public API. But users downstream users can easily switch back to the original behavior if needed by adding a helper function somewhere. It's just 2 lines of code.


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


More information about the llvm-branch-commits mailing list