[LPM] Teach the legacy pass manager to support *using* an analysis
authorChandler Carruth <chandlerc@gmail.com>
Wed, 19 Aug 2015 03:02:12 +0000 (03:02 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Wed, 19 Aug 2015 03:02:12 +0000 (03:02 +0000)
commit8545f7f946f98c47b6a539fb19595ac6072e6967
tree370254878aeacf4640993d9f536187253fc5dd0a
parentdd7ef64b297379c7ec52699c5bb8efb0b2616fc2
[LPM] Teach the legacy pass manager to support *using* an analysis
without *requiring* it.

This allows a pass indicate that it will use an analysis if available
(through getAnalysisIfAvailable). When the pass manager knows this, it
will refrain from deleting that analysis if it can. Naturally, it will
still get invalidated at the correct time. These passes are not
considered when scheduling the pass pipeline, so typically they will
require manual scheduling, but this may also allow passes with
getAnalysisIfAvailable to find the analysis more often if nothing after
them requires that analysis and it wasn't invalidated.

I don't have a particular use case with the current passes, but with my
new structure for alias analyses, this will be very useful. We want to
allow people to customize the set of AAs available by scheduling
additional passes. These's aren't ever *required* for obvious reasons.
So we need some way to mark in the legacy pass manager that they will
still be used if available.

This is essentially how analysis groups already work. But this makes the
feature generally available and more explicit. It should allow the AA
change to not impact how people trigger a custom alias analysis being
available at a certain point in compilation.

Differential Revision: http://reviews.llvm.org/D12114

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245409 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/LegacyPassManagers.h
include/llvm/PassAnalysisSupport.h
lib/IR/LegacyPassManager.cpp