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
39 lines
1.2 KiB
C++
39 lines
1.2 KiB
C++
//====----- Bufferize.cpp - Bufferization of shape ops ---------*- C++-*--===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "mlir/Transforms/Bufferize.h"
|
|
#include "PassDetail.h"
|
|
#include "mlir/Dialect/Shape/Transforms/Passes.h"
|
|
#include "mlir/Pass/Pass.h"
|
|
|
|
using namespace mlir;
|
|
|
|
namespace {
|
|
struct ShapeBufferizePass : public ShapeBufferizeBase<ShapeBufferizePass> {
|
|
void runOnFunction() override {
|
|
MLIRContext &ctx = getContext();
|
|
|
|
RewritePatternSet patterns(&ctx);
|
|
BufferizeTypeConverter typeConverter;
|
|
ConversionTarget target(ctx);
|
|
|
|
populateBufferizeMaterializationLegality(target);
|
|
populateShapeStructuralTypeConversionsAndLegality(typeConverter, patterns,
|
|
target);
|
|
|
|
if (failed(
|
|
applyPartialConversion(getFunction(), target, std::move(patterns))))
|
|
signalPassFailure();
|
|
}
|
|
};
|
|
} // namespace
|
|
|
|
std::unique_ptr<FunctionPass> mlir::createShapeBufferizePass() {
|
|
return std::make_unique<ShapeBufferizePass>();
|
|
}
|