mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[PM] Remove an overly aggressive assert now that I can actually test the
pattern that triggers it. This essentially requires an immutable function analysis, as that will survive anything we do to invalidate it. When we have such patterns, the function analysis manager will not get cleared between runs of the proxy. If we actually need an assert about how things are queried, we can add more elaborate machinery for computing it, but so far I'm not aware of significant value provided. Thanks to Justin Lebar for noticing this when he made a (seemingly innocuous) change to FunctionAttrs that is enough to trigger it in one test there. Now it is covered by a direct test of the pass manager code. llvm-svn: 261627
This commit is contained in:
parent
2694739d00
commit
2b87d730fb
@ -50,7 +50,6 @@ char FunctionAnalysisManagerCGSCCProxy::PassID;
|
||||
|
||||
FunctionAnalysisManagerCGSCCProxy::Result
|
||||
FunctionAnalysisManagerCGSCCProxy::run(LazyCallGraph::SCC &C) {
|
||||
assert(FAM->empty() && "Function analyses ran prior to the CGSCC proxy!");
|
||||
return Result(*FAM);
|
||||
}
|
||||
|
||||
|
@ -102,6 +102,30 @@ private:
|
||||
|
||||
char TestFunctionAnalysis::PassID;
|
||||
|
||||
class TestImmutableFunctionAnalysis {
|
||||
public:
|
||||
struct Result {
|
||||
bool invalidate(Function &, const PreservedAnalyses &) { return false; }
|
||||
};
|
||||
|
||||
static void *ID() { return (void *)&PassID; }
|
||||
static StringRef name() { return "TestImmutableFunctionAnalysis"; }
|
||||
|
||||
TestImmutableFunctionAnalysis(int &Runs) : Runs(Runs) {}
|
||||
|
||||
Result run(Function &F, FunctionAnalysisManager *AM) {
|
||||
++Runs;
|
||||
return Result();
|
||||
}
|
||||
|
||||
private:
|
||||
static char PassID;
|
||||
|
||||
int &Runs;
|
||||
};
|
||||
|
||||
char TestImmutableFunctionAnalysis::PassID;
|
||||
|
||||
struct TestModulePass {
|
||||
TestModulePass(int &RunCount) : RunCount(RunCount) {}
|
||||
|
||||
@ -155,6 +179,9 @@ struct TestSCCPass {
|
||||
TestFunctionAnalysis::Result &FAR =
|
||||
FAM.getResult<TestFunctionAnalysis>(N.getFunction());
|
||||
AnalyzedInstrCount += FAR.InstructionCount;
|
||||
|
||||
// Just ensure we get the immutable results.
|
||||
(void)FAM.getResult<TestImmutableFunctionAnalysis>(N.getFunction());
|
||||
}
|
||||
}
|
||||
|
||||
@ -234,6 +261,10 @@ TEST_F(CGSCCPassManagerTest, Basic) {
|
||||
FunctionAnalysisManager FAM(/*DebugLogging*/ true);
|
||||
int FunctionAnalysisRuns = 0;
|
||||
FAM.registerPass([&] { return TestFunctionAnalysis(FunctionAnalysisRuns); });
|
||||
int ImmutableFunctionAnalysisRuns = 0;
|
||||
FAM.registerPass([&] {
|
||||
return TestImmutableFunctionAnalysis(ImmutableFunctionAnalysisRuns);
|
||||
});
|
||||
|
||||
CGSCCAnalysisManager CGAM(/*DebugLogging*/ true);
|
||||
int SCCAnalysisRuns = 0;
|
||||
@ -277,6 +308,7 @@ TEST_F(CGSCCPassManagerTest, Basic) {
|
||||
EXPECT_EQ(1, ModuleAnalysisRuns);
|
||||
EXPECT_EQ(4, SCCAnalysisRuns);
|
||||
EXPECT_EQ(6, FunctionAnalysisRuns);
|
||||
EXPECT_EQ(6, ImmutableFunctionAnalysisRuns);
|
||||
|
||||
EXPECT_EQ(4, SCCPassRunCount1);
|
||||
EXPECT_EQ(14, AnalyzedInstrCount1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user