[PATCH] D89264: [LICM] Make promotion faster

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 12 13:05:31 PDT 2020


nikic created this revision.
nikic added reviewers: asbirlea, fhahn.
Herald added subscribers: llvm-commits, dexonsmith, steven_wu, george.burgess.iv, hiraditya, Prazek.
Herald added a project: LLVM.
nikic requested review of this revision.

As mentioned at the MSSA roundtable, LICM spends a lot of time construction an AST, despite the caps already in place. This patch is a proposal on how to reduce the impact.

The idea here is pretty simple: We're only interested in must-alias mod sets of loop invariant pointers. As such, only populate the AST with loop-invariant loads and stores (anything else is definitely not promotable) and then discard any sets with alias with any of the remaining, definitely non-promotable accesses.

This has a large positive compile-time impact: https://llvm-compile-time-tracker.com/compare.php?from=d7186fe3710828fab03de69f78f01f001d70e1aa&to=264016756045aba11ae326bfab6a632bc5ef1855&stat=instructions We save ~2% geomean at `O3`, and lencod in particular saves 6%. There's no code-size impact on any of the CTMark programs, so code quality impact of the change should be low.

However, we do lose something here:

- As seen in the 2011-04-06-PromoteResultOfPromotion.ll test, previously it could happen that promotion of one set made the pointers in another loop invariant. We no longer catch such cases, as the non-invariant accesses (at that time) have already been discarded.
- There are regressions in loopversioningLICM1.ll/loopversioningLICM2.ll. Based on an initial analysis these are caused by a different order of checks. Due to AATags intersection, the later accesses no longer register as NoAlias. I'll have to check a bit closer if there's anything to be done there.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89264

Files:
  llvm/lib/Transforms/Scalar/LICM.cpp
  llvm/test/Transforms/LICM/2011-04-06-PromoteResultOfPromotion.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89264.297673.patch
Type: text/x-patch
Size: 9534 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201012/9bacbd93/attachment.bin>


More information about the llvm-commits mailing list