This is an archive of the discontinued LLVM Phabricator instance.

[NewPM] Avoid redundant CGSCC run for updated SCC
ClosedPublic

Authored by wenlei on May 26 2020, 2:02 PM.

Details

Summary

When an SCC got split due to inlining, we have two mechanisms for reprocessing the updated SCC, first is UR.UpdatedC
that repeatedly rerun the new, current SCC; second is a worklist for all newly split SCCs. We can avoid rerun of
the same SCC when the SCC is set to be processed by both mechanisms *back to back*. In pathological cases, such redundant
rerun could cause exponential size growth due to inlining along cycles, even when there's no SCC mutation and hence
convergence is not a problem.

Note that it's ok to have SCC updated and rerun immediately, and also in the work list if we have actually moved an SCC
to be topologically "below" the current one due to merging. In that case, we will need to revisit the current SCC after
those moved SCCs. For that reason, the redundant avoidance here only targets back to back rerun of the same SCC - the
case described by the now removed FIXME comment.

Testing:
Verified compile time for internal repro dropped from 8hr+ to 1hr+.
Verified SPEC2017 performance w/ and w/o this patch is neutral (ThinLTO+NewPM).

Diff Detail

Event Timeline

wenlei created this revision.May 26 2020, 2:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 26 2020, 2:02 PM
wenlei edited the summary of this revision. (Show Details)May 26 2020, 2:10 PM
wenlei added a subscriber: davidxl.
wenlei updated this revision to Diff 266332.May 26 2020, 2:15 PM

update comment

friendly ping..

wmi accepted this revision.Jun 11 2020, 4:42 PM

Based on my limited knowledge of new pass manager, this change looks good. Please wait another day or two before commit in case Chandler has some comment.

This revision is now accepted and ready to land.Jun 11 2020, 4:42 PM
This revision was automatically updated to reflect the committed changes.