[PATCH] D87163: [DSE] Switch to MemorySSA-backed DSE by default.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 4 14:11:11 PDT 2020


fhahn created this revision.
fhahn added reviewers: efriedma, dmgreen, asbirlea, reames.
Herald added subscribers: cfe-commits, lxfind, nikic, kerbowa, jfb, dexonsmith, steven_wu, george.burgess.iv, modocache, hiraditya, Prazek, nhaehnle, jvesely.
Herald added projects: clang, LLVM.
fhahn requested review of this revision.

The tests have been updated and I plan to move them from the MSSA
directory up.

Some end-to-end tests needed small adjustments. One difference to the
legacy DSE is that legacy DSE also deletes trivially dead instructions
that are unrelated to memory operations. Because MemorySSA-backed DSE
just walks the MemorySSA, we only visit/check memory instructions. But
removing unrelated dead instructions is not really DSE's job and other
passes will clean up.

One noteworthy change is in llvm/test/Transforms/Coroutines/ArgAddr.ll,
but I think this comes down to legacy DSE not handling instructions that
may throw correctly in that case. To cover this with MemorySSA-backed
DSE, we need an update to llvm.coro.begin to treat it's return value to
belong to the same underlying object as the passed pointer.

There are some minor cases MemorySSA-backed DSE currently misses, e.g. related
to atomic operations, but I think those can be implemented after the switch.

This has been discussed on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2020-August/144417.html

For the MultiSource/SPEC2000/SPEC2006 the number of eliminated stores
goes from ~17500 (legayc DSE) to ~26300 (MemorySSA-backed). More numbers
and details in the thread on llvm-dev.

Impact on CTMark:

               Legacy Pass Manager
  exec instrs    size-text

O3 <https://reviews.llvm.org/owners/package/3/>                       + 0.60%        - 0.27%
ReleaseThinLTO           + 1.00%        - 0.42%
ReleaseLTO-g.            + 0.77%        - 0.33%
RelThinLTO (link only)   + 0.87%        - 0.42%
RelLO-g (link only)      + 0.78%        - 0.33%

http://llvm-compile-time-tracker.com/compare.php?from=3f22e96d95c71ded906c67067d75278efb0a2525&to=ae8be4642533ff03803967ee9d7017c0d73b0ee0&stat=instructions

                New Pass Manager
  exec instrs.   size-text

O3 <https://reviews.llvm.org/owners/package/3/>                       + 0.95%       - 0.25%
ReleaseThinLTO           + 1.34%       - 0.41%
ReleaseLTO-g.            + 1.71%       - 0.35%
RelThinLTO (link only)   + 0.96%       - 0.41%
RelLO-g (link only)      + 2.21%       - 0.35%

http://195.201.131.214:8000/compare.php?from=3f22e96d95c71ded906c67067d75278efb0a2525&to=ae8be4642533ff03803967ee9d7017c0d73b0ee0&stat=instructions


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87163

Files:
  clang/test/CodeGen/thinlto-distributed-newpm.ll
  clang/test/CodeGenObjC/exceptions.m
  llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
  llvm/test/Analysis/BasicAA/modref.ll
  llvm/test/CodeGen/AMDGPU/opt-pipeline.ll
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-lto-defaults.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/opt-O2-pipeline.ll
  llvm/test/Other/opt-O3-pipeline-enable-matrix.ll
  llvm/test/Other/opt-O3-pipeline.ll
  llvm/test/Other/opt-Os-pipeline.ll
  llvm/test/Transforms/Coroutines/ArgAddr.ll
  llvm/test/Transforms/Coroutines/coro-retcon.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/2011-03-25-DSEMiscompile.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/2011-09-06-EndOfFunction.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/2011-09-06-MemCpy.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/2016-07-17-UseAfterFree.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/OverwriteStoreBegin.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/OverwriteStoreEnd.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/PartialStore.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/PartialStore2.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/X86/gather-null-pointer.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/atomic-overlapping.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/atomic-todo.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/atomic.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/calloc-store.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/combined-partial-overwrites.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/const-pointers.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/crash.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/cs-cs-aliasing.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/debug-counter.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/debuginfo.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/dominate.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/fence-todo.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/fence.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/free.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/inst-limits.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/int_sideeffect.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/invariant.start.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/launder.invariant.group.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/libcalls.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/lifetime.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/mda-with-dbg-values.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/memcpy-complete-overwrite.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/memintrinsics.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/memoryssa-scan-limit.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/memset-and-memcpy.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/memset-missing-debugloc.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/memset-unknown-sizes.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/merge-stores-big-endian.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/merge-stores.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-captures.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-exceptions.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-loops.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-malloc-free.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-memintrinsics.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-memoryphis.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-multipath-throwing.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-multipath.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-overlap.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-partial.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-simple.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-throwing.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-unreachable.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/no-targetdata.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/noop-stores.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/operand-bundles.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/overlap.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/pr11390.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/pr47285-not-overwritten-on-all-exit-paths.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/simple-preservation.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/simple-todo.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/simple.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/stats.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/tail-byval.ll
  llvm/test/Transforms/MemCpyOpt/memcpy.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87163.290026.patch
Type: text/x-patch
Size: 54595 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200904/a539833b/attachment.bin>


More information about the llvm-commits mailing list