[CGSCC][Inliner] Handle new non-trivial edges in updateCGAndAnalysisManagerForPass
authorArthur Eubanks <aeubanks@google.com>
Sat, 7 Nov 2020 02:32:46 +0000 (18:32 -0800)
committerArthur Eubanks <aeubanks@google.com>
Wed, 11 Nov 2020 21:43:49 +0000 (13:43 -0800)
commitd9cbceb041fda981e5bb14f4cbea712302fc9cdb
tree9b0e86a97f3e5431d305b5fb8bddbe309bb1040d
parent1d5daed1997d2fc1fbb6fd19156518bde93d1034
[CGSCC][Inliner] Handle new non-trivial edges in updateCGAndAnalysisManagerForPass

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.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D91046
llvm/lib/Analysis/CGSCCPassManager.cpp
llvm/lib/Transforms/IPO/Inliner.cpp
llvm/unittests/Analysis/CGSCCPassManagerTest.cpp