diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2013-11-22 23:38:07 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2013-11-22 23:38:07 +0000 |
commit | 4d32e85359363d2a6b3898a4d33322155b74eb67 (patch) | |
tree | 0fc64be2c0f7282a97853e6312c3c85123d7ca94 /include | |
parent | 2fd69d0fccd9cdfa91ea6a9e0ad2d8fe50f10b46 (diff) | |
download | llvm-4d32e85359363d2a6b3898a4d33322155b74eb67.tar.gz llvm-4d32e85359363d2a6b3898a4d33322155b74eb67.tar.bz2 llvm-4d32e85359363d2a6b3898a4d33322155b74eb67.tar.xz |
[PM] Switch the downward invalidation to be incremental where only the
one function's analyses are invalidated at a time. Also switch the
preservation of the proxy to *fully* preserve the lower (function)
analyses.
Combined, this gets both upward and downward analysis invalidation to
a point I'm happy with:
- A function pass invalidates its function analyses, and its parent's
module analyses.
- A module pass invalidates all of its functions' analyses including the
set of which functions are in the module.
- A function pass can preserve a module analysis pass.
- If all function passes preserve a module analysis pass, that
preservation persists. If any doesn't the module analysis is
invalidated.
- A module pass can opt into managing *all* function analysis
invalidation itself or *none*.
- The conservative default is none, and the proxy takes the maximally
conservative approach that works even if the set of functions has
changed.
- If a module pass opts into managing function analysis invalidation it
has to propagate the invalidation itself, the proxy just does nothing.
The only thing really missing is a way to query for a cached analysis or
nothing at all. With this, function passes can more safely request
a cached module analysis pass without fear of it accidentally running
part way through.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195519 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/IR/PassManager.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/llvm/IR/PassManager.h b/include/llvm/IR/PassManager.h index 6604c1851c..4d0c09234b 100644 --- a/include/llvm/IR/PassManager.h +++ b/include/llvm/IR/PassManager.h @@ -709,10 +709,22 @@ public: PreservedAnalyses PA = PreservedAnalyses::all(); for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) { PreservedAnalyses PassPA = Pass.run(I, FAM); + + // We know that the function pass couldn't have invalidated any other + // function's analyses (that's the contract of a function pass), so + // directly handle the function analysis manager's invalidation here. + if (FAM) + FAM->invalidate(I, PassPA); + + // Then intersect the preserved set so that invalidation of module + // analyses will eventually occur when the module pass completes. PA.intersect(llvm_move(PassPA)); } - // By definition we preserve the proxy. + // By definition we preserve the proxy. This precludes *any* invalidation + // of function analyses by the proxy, but that's OK because we've taken + // care to invalidate analyses in the function analysis manager + // incrementally above. PA.preserve<FunctionAnalysisManagerModuleProxy>(); return PA; } |