[PATCH] D21462: [PM] Make the the new pass manageg support fully generic extra arguments to run methods, both for transform passes and analysis passes.

Sean Silva via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 23:16:12 PDT 2016


On Wed, Aug 3, 2016 at 12:56 PM, Sean Silva <chisophugis at gmail.com> wrote:

> silvas added a comment.
>
> How do you plan to marshal the variadic arguments for analyses with a
> unified analysis manager for all IRUnit's (w/ dependency tracking)? That
> seems annoying.
>
> I should have some code for the unified analysis manager up today
> hopefully.
>
> I hear your argument (IIRC we discussed this at a social) about back
> pointers being somewhat annoying, but the ability to use just a `void*` to
> represent the information passed to an analysis makes it much easier to
> have a unified analysis manager.
>

After thinking about this a bit more, this backpointer aspect actually fits
naturally with the dependency management.
For correctness, if we have an IRUnit that is generated by an analysis
(e.g. Loop, LazyCallGraph::SCC), we need to track a dependency so that if
the analysis that generates it (LoopInfo, LazyCallGraph respectively) is
invalidated, we invalidate the analysis result.

Therefore, an analysis with Loop as the IRUnitT can always call
getCachedResult<LoopAnalysis> and have a guarantee that it is getting the
correct LoopInfo object (it is truly an assertion in the code that it is
cached and "the right one"). Due to dependency tracking, the LoopInfo
object obtained in this way is guaranteed to be the one intended. So there
is in fact no need to pass extra arguments to provide a "guaranteed
correct" LoopInfo object.

I'm not sure what other use cases there are for passing extra arguments for
analyses, but at least this problem (passing in a "guaranteed correct"
LoopInfo/LazyCallGraph object) is naturally handled by the dependency
tracking.

-- Sean Silva



>
> Note that this issue doesn't apply to transformations since they don't
> participate in the analysis management.
>
>
> https://reviews.llvm.org/D21462
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160808/0913acba/attachment.html>


More information about the llvm-commits mailing list