[LLVMdev] AnalysisUsage: addRequired vs. addRequiredTransitive
Trevor Harmon
Trevor.W.Harmon at nasa.gov
Thu Apr 1 15:37:03 PDT 2010
On Mar 31, 2010, at 3:13 PM, Owen Anderson wrote:
> Some analyses, like Andersen's AA, do all their computation in their
> runOnFunction(). Therefore, anything they depended on can be
> destroyed after the runOnFunction() returns.
What about AA itself? Would addRequired<AliasAnalysis> keep
AliasAnalysis alive (but allow AliasAnalysis's dependencies to die)?
> Others, like MemoryDependenceAnalysis, are "lazy." MDA
> specifically does NOT compute results in its runOnFunction(),
> instead computing results on-demand when a user queries it.
> Because MDA depends on AA, we must ensure that, as long as MDA is
> alive and responding to queries, AA is alive as well. That is what
> addRequiredTransitive does.
I'm not sure if I follow this. So let's say I'm writing a pass Foo,
and Foo depends on MDA. You're saying that Foo's getAnalysisUsage must
call addRequiredTransitive< MemoryDependenceAnalysis>, not
addRequired<MemoryDependenceAnalysis>, because otherwise the
dependencies of Foo's dependencies might be destroyed. Do I have that
right? Thanks,
Trevor
More information about the llvm-dev
mailing list