This is an archive of the discontinued LLVM Phabricator instance.

[LICM] Remove AST-based implementation
ClosedPublic

Authored by nikic on Aug 17 2021, 2:47 PM.

Details

Summary

MSSA-based LICM has been enabled by default for a few years now. This drops the old AST-based implementation. Using loop(licm) will result in a fatal error, the use of loop-mssa(licm) is required (or just licm, which defaults to loop-mssa).

Note that the core canSinkOrHoistInst() logic has to retain AST support for now, because it is shared with LoopSink.

Diff Detail

Event Timeline

nikic created this revision.Aug 17 2021, 2:47 PM
nikic requested review of this revision.Aug 17 2021, 2:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 17 2021, 2:47 PM
asbirlea accepted this revision.Aug 17 2021, 5:07 PM

I'm very much in favor of this cleanup. Thank you for sending it out!
Please clang-format before commit.

This revision is now accepted and ready to land.Aug 17 2021, 5:07 PM
This revision was landed with ongoing or failed builds.Aug 18 2021, 11:22 AM
This revision was automatically updated to reflect the committed changes.

I think further cleanup here will have to wait for the removal of the legacy PM pipeline :( LoopSink doesn't use MSSA in the legacy PM right now, because it's not possible to only compute it if profile data is available.

First, let's wait to make sure this cleanup sticks (I'm thinking of potential out of tree users that may be affected).

Next, I'd suggest trying to measure performance for the following changes:

  • change legacy LoopSink to be a Function pass, processing loops in the same order (preorder, same logic as NPM and as the legacy loop PM)
  • make MSSA not a required analysis, but make it preserved in AU.
  • get the analysis if available, if yes, use it and preserve it (do not compute the AST).
  • if MSSA is not present, before the actual loop processing check if any of the loops has profile data. If so, compute a MemorySSA instantiation for the whole function (new MemorySSA(F, &AA, &DT)) and use that. MemorySSA will not be available for the next passes with this approach. There's currently no option to compute MemorySSA for a single loop and it's not something we plan to support at this time.

This testing would be a good data point on the type of benchmarks in the test-suite. The regressions will remain for functions with few and small loops with profile info.

The options to move forward are either wait for the removal of the legacy PM, or do the cleanup anyway and accept the regression earlier.