39 lines · cpp
1//===------ TestCompositePass.cpp --- composite test pass -----------------===//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-exception6//7//===----------------------------------------------------------------------===//8//9// This file implements a pass to test the composite pass utility.10//11//===----------------------------------------------------------------------===//12 13#include "mlir/Pass/Pass.h"14#include "mlir/Pass/PassManager.h"15#include "mlir/Pass/PassRegistry.h"16#include "mlir/Transforms/Passes.h"17 18namespace mlir {19namespace test {20void registerTestCompositePass() {21 registerPassPipeline(22 "test-composite-fixed-point-pass", "Test composite pass",23 [](OpPassManager &pm, StringRef optionsStr,24 function_ref<LogicalResult(const Twine &)> errorHandler) {25 if (!optionsStr.empty())26 return failure();27 28 pm.addPass(createCompositeFixedPointPass(29 "TestCompositePass", [](OpPassManager &p) {30 p.addPass(createCanonicalizerPass());31 p.addPass(createCSEPass());32 }));33 return success();34 },35 [](function_ref<void(const detail::PassOptions &)>) {});36}37} // namespace test38} // namespace mlir39