[PATCH] D121381: [MemorySSA] Support lazy use optimization

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 10 08:21:53 PST 2022


nikic created this revision.
nikic added reviewers: asbirlea, fhahn, george.burgess.iv, reames.
Herald added a subscriber: hiraditya.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This changes MemorySSA to be constructed in unoptimized form. `MemorySSA::ensureOptimized()` can be called to optimize all uses (once). This should be done by passes where having optimized uses is beneficial, either because we're going to query all uses anyway, or because we're doing def-use walks.

This should help reduce the compile-time impact of MemorySSA for some use cases (the reason why I started looking into this is D117926 <https://reviews.llvm.org/D117926>), which can avoid optimizing all uses upfront, and instead only optimize those that are actually queried.

Actually, we have an existing use-case for this, which is EarlyCSE. Disabling eager use optimization there gives a significant compile-time improvement: http://llvm-compile-time-tracker.com/compare.php?from=59191057243e34d85b644716ef2811bfea8efd1e&to=1dd3499045716e71bad61ccd70700e734a74d350&stat=instructions This is because EarlyCSE will generally only query clobbers for a subset of all uses.

To be more conservative I haven't included the EarlyCSE change here, but I can add it.


https://reviews.llvm.org/D121381

Files:
  llvm/include/llvm/Analysis/MemorySSA.h
  llvm/lib/Analysis/MemorySSA.cpp
  llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
  llvm/lib/Transforms/Scalar/EarlyCSE.cpp
  llvm/lib/Transforms/Scalar/GVNHoist.cpp
  llvm/lib/Transforms/Scalar/LICM.cpp
  llvm/unittests/Analysis/MemorySSATest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121381.414381.patch
Type: text/x-patch
Size: 5591 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220310/a1d9bae4/attachment.bin>


More information about the llvm-commits mailing list