llvm/mlir/test/lib/Transforms/TestMakeIsolatedFromAbove.cpp

//===- TestMakeIsolatedFromAbove.cpp - Test makeIsolatedFromAbove method -===//
//
// 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
//
//===----------------------------------------------------------------------===//

#include "TestDialect.h"
#include "TestOps.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "mlir/Transforms/RegionUtils.h"

usingnamespacemlir;

/// Helper function to call the `makeRegionIsolatedFromAbove` to convert
/// `test.one_region_op` to `test.isolated_one_region_op`.
static LogicalResult
makeIsolatedFromAboveImpl(RewriterBase &rewriter,
                          test::OneRegionWithOperandsOp regionOp,
                          llvm::function_ref<bool(Operation *)> callBack) {}

namespace {

/// Simple test for making region isolated from above without cloning any
/// operations.
struct SimpleMakeIsolatedFromAbove
    : OpRewritePattern<test::OneRegionWithOperandsOp> {};

/// Test for making region isolated from above while clong operations
/// with no operands.
struct MakeIsolatedFromAboveAndCloneOpsWithNoOperands
    : OpRewritePattern<test::OneRegionWithOperandsOp> {};

/// Test for making region isolated from above while clong operations
/// with no operands.
struct MakeIsolatedFromAboveAndCloneOpsWithOperands
    : OpRewritePattern<test::OneRegionWithOperandsOp> {};

/// Test pass for testing the `makeIsolatedFromAbove` function.
struct TestMakeIsolatedFromAbovePass
    : public PassWrapper<TestMakeIsolatedFromAbovePass,
                         OperationPass<func::FuncOp>> {};

} // namespace

void TestMakeIsolatedFromAbovePass::runOnOperation() {}

namespace mlir {
namespace test {
void registerTestMakeIsolatedFromAbovePass() {}
} // namespace test
} // namespace mlir