Fix GCC build problem with 288f05f related to SmallVector. (#116958)
[llvm-project.git] / mlir / test / lib / Dialect / Math / TestAlgebraicSimplification.cpp
blob084a592215241bef24a4ee1fa68d3e8c486adfe2
1 //===- TestAlgebraicSimplification.cpp - Test algebraic 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 //===----------------------------------------------------------------------===//
8 //
9 // This file contains test passes for algebraic simplification patterns.
11 //===----------------------------------------------------------------------===//
13 #include "mlir/Dialect/Math/IR/Math.h"
14 #include "mlir/Dialect/Math/Transforms/Passes.h"
15 #include "mlir/Dialect/Vector/IR/VectorOps.h"
16 #include "mlir/Pass/Pass.h"
17 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
19 using namespace mlir;
21 namespace {
22 struct TestMathAlgebraicSimplificationPass
23 : public PassWrapper<TestMathAlgebraicSimplificationPass, OperationPass<>> {
24 MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(
25 TestMathAlgebraicSimplificationPass)
27 void runOnOperation() override;
28 void getDependentDialects(DialectRegistry &registry) const override {
29 registry.insert<vector::VectorDialect, math::MathDialect>();
31 StringRef getArgument() const final {
32 return "test-math-algebraic-simplification";
34 StringRef getDescription() const final {
35 return "Test math algebraic simplification";
38 } // namespace
40 void TestMathAlgebraicSimplificationPass::runOnOperation() {
41 RewritePatternSet patterns(&getContext());
42 populateMathAlgebraicSimplificationPatterns(patterns);
43 (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns));
46 namespace mlir {
47 namespace test {
48 void registerTestMathAlgebraicSimplificationPass() {
49 PassRegistration<TestMathAlgebraicSimplificationPass>();
51 } // namespace test
52 } // namespace mlir