#include "llvm/Transforms/Scalar/LoopPassManager.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/BlockFrequencyInfo.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/Analysis/MemorySSA.h"
#include "llvm/Analysis/PostDominators.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/AsmParser/Parser.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
#include "llvm/Support/SourceMgr.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
usingnamespacellvm;
namespace {
DoDefault;
Return;
Invoke;
InvokeWithoutArgs;
_;
template <typename DerivedT, typename IRUnitT,
typename AnalysisManagerT = AnalysisManager<IRUnitT>,
typename... ExtraArgTs>
class MockAnalysisHandleBase { … };
template <typename DerivedT, typename IRUnitT, typename AnalysisManagerT,
typename... ExtraArgTs>
AnalysisKey MockAnalysisHandleBase<DerivedT, IRUnitT, AnalysisManagerT,
ExtraArgTs...>::Analysis::Key;
template <size_t I = static_cast<size_t>(-1)>
struct MockLoopAnalysisHandleTemplate
: MockAnalysisHandleBase<MockLoopAnalysisHandleTemplate<I>, Loop,
LoopAnalysisManager,
LoopStandardAnalysisResults &> { … };
MockLoopAnalysisHandle;
struct MockFunctionAnalysisHandle
: MockAnalysisHandleBase<MockFunctionAnalysisHandle, Function> { … };
template <typename DerivedT, typename IRUnitT,
typename AnalysisManagerT = AnalysisManager<IRUnitT>,
typename... ExtraArgTs>
class MockPassHandleBase { … };
struct MockLoopPassHandle
: MockPassHandleBase<MockLoopPassHandle, Loop, LoopAnalysisManager,
LoopStandardAnalysisResults &, LPMUpdater &> { … };
struct MockLoopNestPassHandle
: MockPassHandleBase<MockLoopNestPassHandle, LoopNest, LoopAnalysisManager,
LoopStandardAnalysisResults &, LPMUpdater &> { … };
struct MockFunctionPassHandle
: MockPassHandleBase<MockFunctionPassHandle, Function> { … };
struct MockModulePassHandle : MockPassHandleBase<MockModulePassHandle, Module> { … };
MATCHER_P(HasName, Name, "") { … }
std::unique_ptr<Module> parseIR(LLVMContext &C, const char *IR) { … }
class LoopPassManagerTest : public ::testing::Test { … };
TEST_F(LoopPassManagerTest, Basic) { … }
TEST_F(LoopPassManagerTest, FunctionPassInvalidationOfLoopAnalyses) { … }
TEST_F(LoopPassManagerTest, ModulePassInvalidationOfLoopAnalyses) { … }
TEST_F(LoopPassManagerTest, InvalidationOfBundledAnalyses) { … }
TEST_F(LoopPassManagerTest, IndirectInvalidation) { … }
TEST_F(LoopPassManagerTest, IndirectOuterPassInvalidation) { … }
TEST_F(LoopPassManagerTest, LoopChildInsertion) { … }
TEST_F(LoopPassManagerTest, LoopPeerInsertion) { … }
TEST_F(LoopPassManagerTest, LoopDeletion) { … }
TEST_F(LoopPassManagerTest, HandleLoopNestPass) { … }
}