This is an archive of the discontinued LLVM Phabricator instance.

[CGSCC][Inliner] Handle new non-trivial edges in updateCGAndAnalysisManagerForPass
ClosedPublic

Authored by aeubanks on Nov 8 2020, 8:38 PM.

Details

Summary

Previously the inliner did a bit of a hack by adding ref edges for all
new edges introduced by performing an inline before calling
updateCGAndAnalysisManagerForPass(). This was because
updateCGAndAnalysisManagerForPass() didn't handle new non-trivial call
edges.

This adds handling of non-trivial call edges to
updateCGAndAnalysisManagerForPass(). The inliner called
updateCGAndAnalysisManagerForFunctionPass() since it was handling adding
newly introduced edges (so updateCGAndAnalysisManagerForPass() would
only have to handle promotion), but now it needs to call
updateCGAndAnalysisManagerForCGSCCPass() since
updateCGAndAnalysisManagerForPass() is now handling the new call edges
and function passes cannot add new edges.

We follow the previous path of adding trivial ref edges then letting promotion
handle changing the ref edges to call edges and the CGSCC updates. So
this still does not allow adding call edges that result in an addition
of a non-trivial ref edge.

This is in preparation for better detecting devirtualization. Previously
since the inliner itself would add ref edges,
updateCGAndAnalysisManagerForPass() would think that promotion and thus
devirtualization had happened after any sort of inlining.

Diff Detail

Event Timeline

aeubanks created this revision.Nov 8 2020, 8:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 8 2020, 8:38 PM
aeubanks requested review of this revision.Nov 8 2020, 8:38 PM
aeubanks added inline comments.Nov 10 2020, 10:40 AM
llvm/lib/Analysis/CGSCCPassManager.cpp
550–551

As a side note, this assert was previously incorrect, it should have checked the two SCCs, not RefSCCs. With this change this is now what we actually want to assert. For example, it didn't catch the added test, instead a later assert triggered on the added test.

aeubanks updated this revision to Diff 304255.Nov 10 2020, 10:42 AM

remove leftover dump

asbirlea accepted this revision.Nov 10 2020, 3:20 PM

This is great, thank you!

This revision is now accepted and ready to land.Nov 10 2020, 3:20 PM
This revision was landed with ongoing or failed builds.Nov 11 2020, 1:45 PM
This revision was automatically updated to reflect the committed changes.
uabelho added inline comments.
llvm/lib/Transforms/IPO/Inliner.cpp
947

This seems to be the last use of RC ( I see "set but not used" warnings about RC when compiling with gcc 7.4 now). Should RC be removed now?

aeubanks added inline comments.Nov 12 2020, 10:25 PM
llvm/lib/Transforms/IPO/Inliner.cpp
947