test/lib/Transforms/ has bitrot and become somewhat of a dumping grounds for testing pretty much any part of the project. This revision cleans this up, and moves the files within to a directory that reflects what is actually being tested. Differential Revision: https://reviews.llvm.org/D102456
47 lines
1.5 KiB
C++
47 lines
1.5 KiB
C++
//===- TestComposeSubView.cpp - Test composed subviews --------------------===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file implements a pass to test the composed subview patterns.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "mlir/Dialect/Affine/IR/AffineOps.h"
|
|
#include "mlir/Dialect/StandardOps/Transforms/ComposeSubView.h"
|
|
#include "mlir/Pass/Pass.h"
|
|
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
|
|
|
|
using namespace mlir;
|
|
|
|
namespace {
|
|
struct TestComposeSubViewPass
|
|
: public PassWrapper<TestComposeSubViewPass, FunctionPass> {
|
|
void runOnFunction() override;
|
|
void getDependentDialects(DialectRegistry ®istry) const override;
|
|
};
|
|
|
|
void TestComposeSubViewPass::getDependentDialects(
|
|
DialectRegistry ®istry) const {
|
|
registry.insert<AffineDialect>();
|
|
}
|
|
|
|
void TestComposeSubViewPass::runOnFunction() {
|
|
OwningRewritePatternList patterns(&getContext());
|
|
populateComposeSubViewPatterns(patterns, &getContext());
|
|
(void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns));
|
|
}
|
|
} // namespace
|
|
|
|
namespace mlir {
|
|
namespace test {
|
|
void registerTestComposeSubView() {
|
|
PassRegistration<TestComposeSubViewPass> pass(
|
|
"test-compose-subview", "Test combining composed subviews");
|
|
}
|
|
} // namespace test
|
|
} // namespace mlir
|