This is an archive of the discontinued LLVM Phabricator instance.

[PM] Rework the new PM support for building the ModuleSummaryIndex to directly produce the index as the value type result.
ClosedPublic

Authored by chandlerc on Aug 18 2016, 6:52 PM.

Details

Summary

This requires making the index movable which is straightforward. It
greatly simplifies things by allowing us to completely avoid the builder
API and the layers of abstraction inherent there. Instead both pass
managers can directly construct these when run by value. They still
won't be constructed truly eagerly thanks to the optional in the legacy
PM. The code that directly builds the index can also just share a direct
function.

A notable change here is that the result type of the analysis for the
new PM is no longer a reference type. This was really problematic when
making changes to how we handle result types to make our interface
requirements *much* more strict and precise. But I think this is an
overall improvement.

Diff Detail

Repository
rL LLVM

Event Timeline

chandlerc updated this revision to Diff 68642.Aug 18 2016, 6:52 PM
chandlerc retitled this revision from to [PM] Rework the new PM support for building the ModuleSummaryIndex to directly produce the index as the value type result..
chandlerc updated this object.
chandlerc added a reviewer: tejohnson.
chandlerc added a subscriber: llvm-commits.

LGTM.

I like functions better than classes when possible :)

include/llvm/Analysis/ModuleSummaryAnalysis.h
45 ↗(On Diff #68642)

You define a typedef for Result two lines above, why not using it here?

I don't think it is used anywhere, if it is only used by the pass manager infrastructure, maybe add a comment above the typedef.

chandlerc added inline comments.Aug 18 2016, 8:39 PM
include/llvm/Analysis/ModuleSummaryAnalysis.h
45 ↗(On Diff #68642)

Happy to use the typedef if you prefer.

But the typedef is for the pass manager infrastructure. I can comment it, but it is a fairly pervasive pattern so not sure how much value that comment adds. Thoughts? Would you like a comment on all the Result typedefs?

mehdi_amini added inline comments.Aug 18 2016, 8:41 PM
include/llvm/Analysis/ModuleSummaryAnalysis.h
45 ↗(On Diff #68642)

Well you're right, since it is new we're not used to see it everywhere, but since it is gonna be everywhere we probably won't need to replicate the one line comment on each and every instance.

tejohnson accepted this revision.Aug 18 2016, 10:01 PM
tejohnson edited edge metadata.

LGTM. Thanks for the cleanup!

This revision is now accepted and ready to land.Aug 18 2016, 10:01 PM
This revision was automatically updated to reflect the committed changes.