[WIP][mlir] Resolve memref dependency in canonicalize pass.

Splitting the memref dialect lead to an introduction of several dependencies
to avoid compilation issues. The canonicalize pass also depends on the
memref dialect, but it shouldn't. This patch resolves the dependencies
and the unintuitive includes are removed. However, the dependency moves
to the constructor of the std dialect.

Differential Revision: https://reviews.llvm.org/D102060
This commit is contained in:
Julian Gross 2021-05-07 12:38:12 +02:00
parent 7c16f93c44
commit 1fbb484ea4
8 changed files with 4 additions and 6 deletions

View File

@ -14,6 +14,7 @@
#ifndef MLIR_DIALECT_STANDARDOPS_IR_OPS_H #ifndef MLIR_DIALECT_STANDARDOPS_IR_OPS_H
#define MLIR_DIALECT_STANDARDOPS_IR_OPS_H #define MLIR_DIALECT_STANDARDOPS_IR_OPS_H
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/Builders.h" #include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Dialect.h" #include "mlir/IR/Dialect.h"

View File

@ -27,6 +27,9 @@ def StandardOps_Dialect : Dialect {
let name = "std"; let name = "std";
let cppNamespace = ""; let cppNamespace = "";
let hasConstantMaterializer = 1; let hasConstantMaterializer = 1;
// TODO: This dependency is needed to handle memref ops in the
// canonicalize pass and should be resolved.
let dependentDialects = ["memref::MemRefDialect"];
} }
// Base class for Standard dialect ops. // Base class for Standard dialect ops.

View File

@ -362,7 +362,6 @@ def Canonicalizer : Pass<"canonicalize"> {
details. details.
}]; }];
let constructor = "mlir::createCanonicalizerPass()"; let constructor = "mlir::createCanonicalizerPass()";
let dependentDialects = ["memref::MemRefDialect"];
} }
def CSE : Pass<"cse"> { def CSE : Pass<"cse"> {

View File

@ -18,7 +18,6 @@
#include "mlir/Dialect/GPU/Passes.h" #include "mlir/Dialect/GPU/Passes.h"
#include "mlir/Dialect/LLVMIR/NVVMDialect.h" #include "mlir/Dialect/LLVMIR/NVVMDialect.h"
#include "mlir/Dialect/Math/IR/Math.h" #include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/IR/BlockAndValueMapping.h" #include "mlir/IR/BlockAndValueMapping.h"
#include "mlir/Transforms/DialectConversion.h" #include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h"

View File

@ -23,7 +23,6 @@
#include "mlir/Analysis/Utils.h" #include "mlir/Analysis/Utils.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h" #include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/Passes.h" #include "mlir/Dialect/Affine/Passes.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h" #include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "mlir/Transforms/LoopUtils.h" #include "mlir/Transforms/LoopUtils.h"

View File

@ -8,7 +8,6 @@
#include "mlir/Transforms/Bufferize.h" #include "mlir/Transforms/Bufferize.h"
#include "PassDetail.h" #include "PassDetail.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/Passes.h" #include "mlir/Dialect/SCF/Passes.h"
#include "mlir/Dialect/SCF/SCF.h" #include "mlir/Dialect/SCF/SCF.h"
#include "mlir/Dialect/SCF/Transforms.h" #include "mlir/Dialect/SCF/Transforms.h"

View File

@ -8,7 +8,6 @@
#include "mlir/Transforms/Bufferize.h" #include "mlir/Transforms/Bufferize.h"
#include "PassDetail.h" #include "PassDetail.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/Shape/Transforms/Passes.h" #include "mlir/Dialect/Shape/Transforms/Passes.h"
#include "mlir/Pass/Pass.h" #include "mlir/Pass/Pass.h"

View File

@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "PassDetail.h" #include "PassDetail.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Pass/Pass.h" #include "mlir/Pass/Pass.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h" #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "mlir/Transforms/Passes.h" #include "mlir/Transforms/Passes.h"