llvm-project/llvm/test/Transforms/DeadStoreElimination/MSSA
Nikita Popov 1f1145006b [DSE] Use correct memory location for read clobber check
MSSA DSE starts at a killing store, finds an earlier store and
then checks that the earlier store is not read along any paths
(without being killed first). However, it uses the memory location
of the killing store for that, not the earlier store that we're
attempting to eliminate.

This has a number of problems:

* Mismatches between what BasicAA considers aliasing and what DSE
  considers an overwrite (even though both are correct in isolation)
  can result in miscompiles. This is PR48279, which D92045 tries to
  fix in a different way. The problem is that we're using a location
  from a store that is potentially not executed and thus may be UB,
  in which case analysis results can be arbitrary.
* Metadata on the killing store may be used to determine aliasing,
  but there is no guarantee that the metadata is valid, as the specific
  killing store may not be executed. Using the metadata on the earlier
  store is valid (it is the store we're removing, so on any execution
  where its removal may be observed, it must be executed).
* The location is imprecise. For full overwrites the killing store
  will always have a location that is larger or equal than the earlier
  access location, so it's beneficial to use the earlier access
  location. This is not the case for partial overwrites, in which
  case either location might be smaller. There is some room for
  improvement here.

Using the earlier access location means that we can no longer cache
which accesses are read for a given killing store, as we may be
querying different locations. However, it turns out that simply
dropping the cache has no notable impact on compile-time.

Differential Revision: https://reviews.llvm.org/D93523
2020-12-18 20:26:53 +01:00
..
X86 Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
2011-03-25-DSEMiscompile.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
2011-09-06-EndOfFunction.ll OpaquePtr: Bulk update tests to use typed sret 2020-11-20 17:58:26 -05:00
2011-09-06-MemCpy.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
2016-07-17-UseAfterFree.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
OverwriteStoreBegin.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
OverwriteStoreEnd.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
PartialStore.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
PartialStore2.ll [DeadStoreElimination] Remove unused check-prefixes 2020-11-09 17:21:28 +00:00
atomic-overlapping.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
atomic-todo.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
atomic.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
calloc-store.ll [DSE] Remove noop stores after killing stores for a MemoryDef. 2020-10-30 09:40:15 +00:00
combined-partial-overwrites.ll OpaquePtr: Bulk update tests to use typed sret 2020-11-20 17:58:26 -05:00
const-pointers.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
crash.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
cs-cs-aliasing.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
debug-counter.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
debuginfo.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
dominate.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
fence-todo.ll OpaquePtr: Bulk update tests to use typed byval 2020-11-20 14:00:46 -05:00
fence.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
free.ll [DSE] Use same logic as legacy impl to check if free kills a location. 2020-10-31 20:09:25 +00:00
inst-limits.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
int_sideeffect.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
invariant.start.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
launder.invariant.group.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
libcalls.ll [DeadStoreElimination] Remove unused check-prefixes 2020-11-09 17:21:28 +00:00
lifetime.ll [DSE] Do not scan users of memory terminators for further reads. 2020-10-20 16:55:22 +01:00
mda-with-dbg-values.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
memcpy-complete-overwrite.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
memcpy-lifetimes.ll [NewPM][BasicAA] basicaa -> basic-aa in Transforms/DeadStoreElimination 2020-06-26 20:13:37 -07:00
memintrinsics.ll [Intrinsics] Added writeonly attribute to the first arg of llvm.memmove 2020-10-19 23:09:41 +02:00
memoryssa-scan-limit.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
memset-and-memcpy.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
memset-missing-debugloc.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
memset-unknown-sizes.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
merge-stores-big-endian.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
merge-stores.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
multiblock-captures.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
multiblock-exceptions.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
multiblock-loop-carried-dependence.ll [DSE] Add another test cases with loop carried dependence. 2020-09-16 14:50:35 +01:00
multiblock-loops.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
multiblock-malloc-free.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
multiblock-memintrinsics.ll [DSE] Use correct memory location for read clobber check 2020-12-18 20:26:53 +01:00
multiblock-memoryphis.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
multiblock-multipath-throwing.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
multiblock-multipath.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
multiblock-overlap.ll [DSE] Improve partial overlap detection 2020-10-30 22:23:20 +07:00
multiblock-partial.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
multiblock-simple.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
multiblock-throwing.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
multiblock-unreachable.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
no-targetdata.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
noop-stores.ll [DSE] Remove noop stores after killing stores for a MemoryDef. 2020-10-30 09:40:15 +00:00
operand-bundles.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
out-of-bounds-stores.ll [DSE] Use correct memory location for read clobber check 2020-12-18 20:26:53 +01:00
overlap.ll [DSE] Use correct memory location for read clobber check 2020-12-18 20:26:53 +01:00
pr11390.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
pr47285-not-overwritten-on-all-exit-paths.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
read-clobber-after-overwrite.ll [DSE,MemorySSA] Add an early check for read clobbers to traversal. 2020-09-07 23:22:10 +01:00
scoped-noalias.ll [DSE] Use correct memory location for read clobber check 2020-12-18 20:26:53 +01:00
simple-preservation.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
simple.ll OpaquePtr: Bulk update tests to use typed byval 2020-11-20 14:00:46 -05:00
stats.ll Recommit "[DSE] Switch to MemorySSA-backed DSE by default." 2020-10-16 09:02:53 +01:00
tail-byval.ll OpaquePtr: Bulk update tests to use typed byval 2020-11-20 14:00:46 -05:00