• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- TestExpandTanh.cpp - Test expand tanh op into exp form ------===//
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 expanding tanh.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "mlir/Dialect/StandardOps/Transforms/Passes.h"
14 #include "mlir/Pass/Pass.h"
15 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
16 
17 using namespace mlir;
18 
19 namespace {
20 struct TestExpandTanhPass
21     : public PassWrapper<TestExpandTanhPass, FunctionPass> {
22   void runOnFunction() override;
23 };
24 } // end anonymous namespace
25 
runOnFunction()26 void TestExpandTanhPass::runOnFunction() {
27   OwningRewritePatternList patterns;
28   populateExpandTanhPattern(patterns, &getContext());
29   applyPatternsAndFoldGreedily(getOperation(), std::move(patterns));
30 }
31 
32 namespace mlir {
33 namespace test {
registerTestExpandTanhPass()34 void registerTestExpandTanhPass() {
35   PassRegistration<TestExpandTanhPass> pass("test-expand-tanh",
36                                             "Test expanding tanh");
37 }
38 } // namespace test
39 } // namespace mlir
40