diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2015-01-05 12:32:11 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2015-01-05 12:32:11 +0000 |
commit | 539dc4b9d511918c68a0c4b83c37fc8ff5703ad6 (patch) | |
tree | 6bce37100b28233fa71b7a5b6fb40ebcb2c90fe9 /llvm/lib/IR/PassManager.cpp | |
parent | e5e8fb3bf625ba14740b002687a5df581701ee83 (diff) | |
download | bcm5719-llvm-539dc4b9d511918c68a0c4b83c37fc8ff5703ad6.tar.gz bcm5719-llvm-539dc4b9d511918c68a0c4b83c37fc8ff5703ad6.zip |
[PM] Don't run the machinery of invalidating all the analysis passes
when all are being preserved.
We want to short-circuit this for a couple of reasons. One, I don't
really want passes to grow a dependency on actually receiving their
invalidate call when they've been preserved. I'm thinking about removing
this entirely. But more importantly, preserving everything is likely to
be the common case in a lot of scenarios, and it would be really good to
bypass all of the invalidation and preservation machinery there.
Avoiding calling N opaque functions to try to invalidate things that are
by definition still valid seems important. =]
This wasn't really inpsired by much other than seeing the spam in the
logging for analyses, but it seems better ot get it checked in rather
than forgetting about it.
llvm-svn: 225163
Diffstat (limited to 'llvm/lib/IR/PassManager.cpp')
-rw-r--r-- | llvm/lib/IR/PassManager.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/IR/PassManager.cpp b/llvm/lib/IR/PassManager.cpp index c7638bb7fce..1eab4ae19bf 100644 --- a/llvm/lib/IR/PassManager.cpp +++ b/llvm/lib/IR/PassManager.cpp @@ -78,6 +78,10 @@ void ModuleAnalysisManager::invalidateImpl(void *PassID, Module &M) { void ModuleAnalysisManager::invalidateImpl(Module &M, const PreservedAnalyses &PA) { + // Short circuit for a common case of all analyses being preserved. + if (PA.areAllPreserved()) + return; + if (DebugPM) dbgs() << "Invalidating all non-preserved analyses for module: " << M.getModuleIdentifier() << "\n"; @@ -176,6 +180,10 @@ void FunctionAnalysisManager::invalidateImpl(void *PassID, Function &F) { void FunctionAnalysisManager::invalidateImpl(Function &F, const PreservedAnalyses &PA) { + // Short circuit for a common case of all analyses being preserved. + if (PA.areAllPreserved()) + return; + if (DebugPM) dbgs() << "Invalidating all non-preserved analyses for function: " << F.getName() << "\n"; |