This is an archive of the discontinued LLVM Phabricator instance.

[attrs] Split the late-revisit pattern for deducing norecurse in a top-down manner into a true top-down or RPO pass over the call graph.
ClosedPublic

Authored by chandlerc on Dec 27 2015, 1:59 AM.

Details

Summary

There are specific patterns of function attributes, notably the
norecurse attribute, which are most effectively propagated top-down
because all they us caller information.

Walk in RPO over the call graph SCCs takes the form of a module pass run
immediately after the CGSCC pass managers postorder walk of the SCCs,
trying again to deduce norerucrse for each singular SCC in the call
graph.

This removes a very legacy pass manager specific trick of using a lazy
revisit list traversed during finalization of the CGSCC pass. There is
no analogous finalization step in the new pass manager, and a lazy
revisit list is just trying to produce an RPO iteration of the call
graph. We can do that more directly if more expensively. It seems
unlikely that this will be the expensive part of any compilation though
as we never examine the function bodies here. Even in an LTO run over
a very large module, this should be a reasonable fast set of operations
over a reasonably small working set -- the function call graph itself.

In the future, if this really is a compile time performance issue, we
can look at building support for both post order and RPO traversals
directly into a pass manager that builds and maintains the PO list of
SCCs.

Diff Detail

Repository
rL LLVM

Event Timeline

chandlerc updated this revision to Diff 43653.Dec 27 2015, 1:59 AM
chandlerc retitled this revision from to [attrs] Split the late-revisit pattern for deducing norecurse in a top-down manner into a true top-down or RPO pass over the call graph..
chandlerc updated this object.
chandlerc added a reviewer: jmolloy.
chandlerc added a subscriber: llvm-commits.
jmolloy accepted this revision.Jan 6 2016, 5:41 AM
jmolloy edited edge metadata.

One typo, but otherwise LGTM.

Thanks for doing this!

lib/Transforms/IPO/FunctionAttrs.cpp
1019 ↗(On Diff #43653)

significantly

This revision is now accepted and ready to land.Jan 6 2016, 5:41 AM
This revision was automatically updated to reflect the committed changes.