llvm/mlir/unittests/Support/CyclicReplacerCacheTest.cpp

//===- CyclicReplacerCacheTest.cpp ----------------------------------------===//
//
// 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 "mlir/Support/CyclicReplacerCache.h"
#include "mlir/Support/LLVM.h"
#include "llvm/ADT/SetVector.h"
#include "gmock/gmock.h"
#include <map>
#include <set>

usingnamespacemlir;

TEST(CachedCyclicReplacerTest, testNoRecursion) {}

TEST(CachedCyclicReplacerTest, testInPlaceRecursionPruneAnywhere) {}

//===----------------------------------------------------------------------===//
// CachedCyclicReplacer: ChainRecursion
//===----------------------------------------------------------------------===//

/// This set of tests uses a replacer function that maps ints into vectors of
/// ints.
///
/// The replacement result for input `n` is the replacement result of `(n+1)%3`
/// appended with an element `42`. Theoretically, this will produce an
/// infinitely long vector. The cycle-breaker function prunes this infinite
/// recursion in the replacer logic by returning an empty vector upon the first
/// re-occurrence of an input value.
namespace {
class CachedCyclicReplacerChainRecursionPruningTest : public ::testing::Test {};
} // namespace

TEST_F(CachedCyclicReplacerChainRecursionPruningTest, testPruneAnywhere0) {}

TEST_F(CachedCyclicReplacerChainRecursionPruningTest, testPruneAnywhere1) {}

TEST_F(CachedCyclicReplacerChainRecursionPruningTest, testPruneSpecific0) {}

TEST_F(CachedCyclicReplacerChainRecursionPruningTest, testPruneSpecific1) {}

//===----------------------------------------------------------------------===//
// CachedCyclicReplacer: GraphReplacement
//===----------------------------------------------------------------------===//

/// This set of tests uses a replacer function that maps from cyclic graphs to
/// trees, pruning out cycles in the process.
///
/// It consists of two helper classes:
/// - Graph
///   - A directed graph where nodes are non-negative integers.
/// - PrunedGraph
///   - A Graph where edges that used to cause cycles are now represented with
///     an indirection (a recursionId).
namespace {
class CachedCyclicReplacerGraphReplacement : public ::testing::Test {};
} // namespace

TEST_F(CachedCyclicReplacerGraphReplacement, testSingleLoop) {}

TEST_F(CachedCyclicReplacerGraphReplacement, testDualLoop) {}

TEST_F(CachedCyclicReplacerGraphReplacement, testNestedLoops) {}

TEST_F(CachedCyclicReplacerGraphReplacement, testDualNestedLoops) {}