TargetParser: AArch64: Add part numbers for Apple CPUs.
[llvm-project.git] / mlir / test / lib / Dialect / Mesh / TestSimplifications.cpp
blob512b16af64c945c1e82172145f80da995bc5bf54
1 //===- TestSimplification.cpp - Test simplification -----------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "mlir/Dialect/Arith/IR/Arith.h"
10 #include "mlir/Dialect/Mesh/IR/MeshDialect.h"
11 #include "mlir/Dialect/Mesh/Transforms/Simplifications.h"
12 #include "mlir/IR/SymbolTable.h"
13 #include "mlir/Pass/Pass.h"
14 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
16 using namespace mlir;
18 namespace {
19 struct TestMeshSimplificationsPass
20 : public PassWrapper<TestMeshSimplificationsPass, OperationPass<>> {
21 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestMeshSimplificationsPass)
23 void runOnOperation() override;
24 void getDependentDialects(DialectRegistry &registry) const override {
25 registry.insert<arith::ArithDialect, mesh::MeshDialect>();
27 StringRef getArgument() const final { return "test-mesh-simplifications"; }
28 StringRef getDescription() const final { return "Test mesh simplifications"; }
30 } // namespace
32 void TestMeshSimplificationsPass::runOnOperation() {
33 RewritePatternSet patterns(&getContext());
34 SymbolTableCollection symbolTableCollection;
35 mesh::populateSimplificationPatterns(patterns, symbolTableCollection);
36 [[maybe_unused]] LogicalResult status =
37 applyPatternsAndFoldGreedily(getOperation(), std::move(patterns));
38 assert(succeeded(status) && "Rewrite patters application did not converge.");
41 namespace mlir {
42 namespace test {
43 void registerTestMeshSimplificationsPass() {
44 PassRegistration<TestMeshSimplificationsPass>();
46 } // namespace test
47 } // namespace mlir