[all-commits] [llvm/llvm-project] d0c4d4: [DSE] Add first version of MemorySSA-backed DSE (B...
Florian Hahn via All-commits
all-commits at lists.llvm.org
Mon Feb 10 03:52:44 PST 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: d0c4d4fe0929098a98d9fb20c5e5e19d71341517
https://github.com/llvm/llvm-project/commit/d0c4d4fe0929098a98d9fb20c5e5e19d71341517
Author: Florian Hahn <flo at fhahn.com>
Date: 2020-02-10 (Mon, 10 Feb 2020)
Changed paths:
M llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
M llvm/test/Transforms/DeadStoreElimination/MSSA/2011-09-06-EndOfFunction.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/OverwriteStoreBegin.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/OverwriteStoreEnd.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/atomic.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/calloc-store.ll
A llvm/test/Transforms/DeadStoreElimination/MSSA/fence-todo.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/fence.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/free.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/inst-limits.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/lifetime.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/memcpy-complete-overwrite.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/memintrinsics.ll
A llvm/test/Transforms/DeadStoreElimination/MSSA/memoryssa-scan-limit.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/memset-and-memcpy.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/memset-missing-debugloc.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/merge-stores-big-endian.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/merge-stores.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-captures.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-exceptions.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-loops.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-memoryphis.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-partial.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-simple.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/operand-bundles.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/simple-todo.ll
M llvm/test/Transforms/DeadStoreElimination/MSSA/simple.ll
Log Message:
-----------
[DSE] Add first version of MemorySSA-backed DSE (Bottom up walk).
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.
The patch uses the following general approach: given a MemoryDef, walk
upwards to find clobbering MemoryDefs that may be killed by the
starting def. Then check that there are no uses that may read the
location of the original MemoryDef in between both MemoryDefs. A bit
more concretely:
For all MemoryDefs StartDef:
1. Get the next dominating clobbering MemoryDef (DomAccess) by walking upwards.
2. Check that there no reads between DomAccess and the StartDef by checking
all uses starting at DomAccess and walking until we see StartDef.
3. For each found DomDef, check that:
1. There are no barrier instructions between DomDef and StartDef (like
throws or stores with ordering constraints).
2. StartDef is executed whenever DomDef is executed.
3. StartDef completely overwrites DomDef.
4. Erase DomDef from the function and MemorySSA.
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 additional
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 loosely based on D40480 by Dave Green.
Reviewers: dmgreen, rnk, efriedma, bryant, asbirlea, Tyker
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D72700
More information about the All-commits
mailing list