This is an archive of the discontinued LLVM Phabricator instance.

[LICM] Don't require optimized uses
ClosedPublic

Authored by nikic on Apr 3 2023, 4:51 AM.

Details

Summary

LICM currently requests optimized use MSSA form. This is wasteful, because LICM doesn't actually care about most uses, only those of invariant pointers in loops. Everything else doesn't need to be optimized.

LICM already uses the clobber walker in most places. This patch adjusts one place that was using getDefiningAccess() to use it as well, so we no longer have a dependence on pre-optimized uses.

This change is not NFC in that the fallback on the defining access when there are too many clobber calls may now fall back to an unoptimized use. In practice, I've not seen any problems with this though. If desired, we could also increase licm-mssa-optimization-cap to a higher value (increasing this from 100 to 200 has no impact on average compile-time -- but also doesn't appear to have any impact on LICM quality either).

This makes for a 0.9% geomean compile-time improvement: http://llvm-compile-time-tracker.com/compare.php?from=6afe972195454a1110ed8d20c6f2a547e6366379&to=fb64abececc685794fff46227eb7f383218150ce&stat=instructions:u

Diff Detail

Event Timeline

nikic created this revision.Apr 3 2023, 4:51 AM
nikic requested review of this revision.Apr 3 2023, 4:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 3 2023, 4:51 AM
dtcxzyw added a subscriber: dtcxzyw.Apr 3 2023, 8:49 AM
fhahn accepted this revision.Apr 4 2023, 9:48 AM

LGTM given the good wins in compile-time vs the small number of changes in the test set.

If this is the source of regressions we can always adjust the limit

This revision is now accepted and ready to land.Apr 4 2023, 9:48 AM
This revision was landed with ongoing or failed builds.Apr 5 2023, 2:20 AM
This revision was automatically updated to reflect the committed changes.