[PATCH] D72700: [DSE] Add first version of MemorySSA-backed DSE (Bottom up walk).

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 06:16:30 PST 2020


fhahn created this revision.
Herald added subscribers: asbirlea, jfb, george.burgess.iv, hiraditya, Prazek.
Herald added a project: LLVM.

This patch adds a first version of a MemorySSA based DSE. It is missing
a lot of features, which will get added as follow-ups, to help to keep
the review manageable.

For each MemoryDef, we walk bottom-up to find MemoryDefs that are killed
by the MemoryDef. During the walk, we bail out if we hit either:

- A MemoryPhi (restriction will be lifted later).
- An aliasing MemoryAccess.

The patch uses a very simple approach to guarantee that no throwing
instructions are between 2 stores: We only allow accesses to stack
objects, access that are in the same basic block if the block does not
contain any throwing instructions or accesses in functions that do
not contain any throwing instructions. This will get lifted later.

Besides adding support for the missing cases, there is plenty of additonal
potential for improvements as follow-up work, e.g. the way we visit stores
(could be just a traversal of the MemorySSA, rather than collecting them
up-front), using the alias information discovered during walking to optimize
the MemorySSA.

This is based on D40480 <https://reviews.llvm.org/D40480> by Dave Green.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D72700

Files:
  llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
  llvm/test/Transforms/DeadStoreElimination/MSSA/PartialStore.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/fence-todo.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/fence.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/memcpy-complete-overwrite.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/memcpy-lifetimes.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/memoryssa-scan-limit.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/memset-and-memcpy.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-partial.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-simple.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-throwing.ll
  llvm/test/Transforms/DeadStoreElimination/MSSA/simple.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72700.237958.patch
Type: text/x-patch
Size: 102013 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200114/3d1932fb/attachment-0001.bin>


More information about the llvm-commits mailing list