1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00

[UnitTests] Add invalidate methods.

This commit is contained in:
Alina Sbirlea 2020-01-15 14:30:21 -08:00
parent c5959f21b3
commit 62ee34a755
2 changed files with 36 additions and 0 deletions

View File

@ -27,6 +27,13 @@ public:
struct Result {
Result(int Count) : FunctionCount(Count) {}
int FunctionCount;
bool invalidate(Module &, const PreservedAnalyses &PA,
ModuleAnalysisManager::Invalidator &) {
// Check whether the analysis or all analyses on modules have been
// preserved.
auto PAC = PA.getChecker<TestModuleAnalysis>();
return !(PAC.preserved() || PAC.preservedSet<AllAnalysesOn<Module>>());
}
};
TestModuleAnalysis(int &Runs) : Runs(Runs) {}
@ -50,6 +57,14 @@ public:
struct Result {
Result(int Count) : FunctionCount(Count) {}
int FunctionCount;
bool invalidate(LazyCallGraph::SCC &, const PreservedAnalyses &PA,
CGSCCAnalysisManager::Invalidator &) {
// Check whether the analysis or all analyses on SCCs have been
// preserved.
auto PAC = PA.getChecker<TestSCCAnalysis>();
return !(PAC.preserved() ||
PAC.preservedSet<AllAnalysesOn<LazyCallGraph::SCC>>());
}
};
TestSCCAnalysis(int &Runs) : Runs(Runs) {}
@ -73,6 +88,13 @@ public:
struct Result {
Result(int Count) : InstructionCount(Count) {}
int InstructionCount;
bool invalidate(Function &, const PreservedAnalyses &PA,
FunctionAnalysisManager::Invalidator &) {
// Check whether the analysis or all analyses on functions have been
// preserved.
auto PAC = PA.getChecker<TestFunctionAnalysis>();
return !(PAC.preserved() || PAC.preservedSet<AllAnalysesOn<Function>>());
}
};
TestFunctionAnalysis(int &Runs) : Runs(Runs) {}

View File

@ -23,6 +23,13 @@ public:
struct Result {
Result(int Count) : InstructionCount(Count) {}
int InstructionCount;
bool invalidate(Function &, const PreservedAnalyses &PA,
FunctionAnalysisManager::Invalidator &) {
// Check whether the analysis or all analyses on functions have been
// preserved.
auto PAC = PA.getChecker<TestFunctionAnalysis>();
return !(PAC.preserved() || PAC.preservedSet<AllAnalysesOn<Function>>());
}
};
TestFunctionAnalysis(int &Runs) : Runs(Runs) {}
@ -52,6 +59,13 @@ public:
struct Result {
Result(int Count) : FunctionCount(Count) {}
int FunctionCount;
bool invalidate(Module &, const PreservedAnalyses &PA,
ModuleAnalysisManager::Invalidator &) {
// Check whether the analysis or all analyses on modules have been
// preserved.
auto PAC = PA.getChecker<TestModuleAnalysis>();
return !(PAC.preserved() || PAC.preservedSet<AllAnalysesOn<Module>>());
}
};
TestModuleAnalysis(int &Runs) : Runs(Runs) {}