[Mlir-commits] [mlir] 5d7c832 - [mlir] add memref dialect as dependent of lower-affine pass

Alex Zinenko llvmlistbot at llvm.org
Fri Apr 2 00:17:18 PDT 2021


Author: Alex Zinenko
Date: 2021-04-02T09:17:10+02:00
New Revision: 5d7c832e8c14ec0a2823528f8fbbfd3a9e96c828

URL: https://github.com/llvm/llvm-project/commit/5d7c832e8c14ec0a2823528f8fbbfd3a9e96c828
DIFF: https://github.com/llvm/llvm-project/commit/5d7c832e8c14ec0a2823528f8fbbfd3a9e96c828.diff

LOG: [mlir] add memref dialect as dependent of lower-affine pass

The lower-affine pass also processes affine load and store operations
that get converted to load and store operations now available in the
memref dialect. Since it produces operations from the memref dialect,
this dialect should be registered as dependent for this pass. It is rare
but possible to have code that doesn't have memref operations in the
input and calls this pass.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D99720

Added: 
    mlir/test/Conversion/AffineToStandard/no-memref.mlir

Modified: 
    mlir/include/mlir/Conversion/Passes.td

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Conversion/Passes.td b/mlir/include/mlir/Conversion/Passes.td
index 79af5b3d0e150..49912f1c92ab4 100644
--- a/mlir/include/mlir/Conversion/Passes.td
+++ b/mlir/include/mlir/Conversion/Passes.td
@@ -67,6 +67,7 @@ def ConvertAffineToStandard : Pass<"lower-affine"> {
   }];
   let constructor = "mlir::createLowerAffinePass()";
   let dependentDialects = [
+    "memref::MemRefDialect",
     "scf::SCFDialect",
     "StandardOpsDialect",
     "vector::VectorDialect"

diff  --git a/mlir/test/Conversion/AffineToStandard/no-memref.mlir b/mlir/test/Conversion/AffineToStandard/no-memref.mlir
new file mode 100644
index 0000000000000..4b5bee174e84f
--- /dev/null
+++ b/mlir/test/Conversion/AffineToStandard/no-memref.mlir
@@ -0,0 +1,11 @@
+// RUN: mlir-opt -lower-affine %s | FileCheck %s
+
+// Regression test checking that the memref dialect is loaded as dependency by
+// the lowering pass. We shouldn't fail trying to create memref.load here.
+
+// CHECK-LABEL: @no_memref_op
+func @no_memref_op(%arg0: memref<f32>) {
+  // CHECK: memref.load
+  affine.load %arg0[] : memref<f32>
+  return
+}


        


More information about the Mlir-commits mailing list