1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
llvm-mirror/test/Transforms/MemCpyOpt
Nikita Popov c645cd0965 Reapply "[MemCpyOpt] memset->memcpy forwarding with undef tail"
Currently memcpyopt optimizes cases like

    memset(a, byte, N);
    memcpy(b, a, M);

to

    memset(a, byte, N);
    memset(b, byte, M);

if M <= N. Often this allows further simplifications down the line,
which drop the first memset entirely.

This patch extends this optimization for the case where M > N, but we
know that the bytes a[N..M] are undef due to alloca/lifetime.start.

This situation arises relatively often for Rust code, because Rust does
not initialize trailing structure padding and loves to insert redundant
memcpys. This also fixes https://bugs.llvm.org/show_bug.cgi?id=39844.

The previous version of this patch did not perform dependency checking
properly: While the dependency is checked at the position of the memset,
the used size must be that of the memcpy. Previously the size of the
memset was used, which missed modification in the region
MemSetSize..CopySize, resulting in miscompiles. The added tests cover
variations of this issue.

Differential Revision: https://reviews.llvm.org/D55120

llvm-svn: 349078
2018-12-13 20:04:27 +00:00
..
2008-02-24-MultipleUseofSRet.ll
2008-03-13-ReturnSlotBitcast.ll
2011-06-02-CallSlotOverwritten.ll
align.ll
atomic.ll
callslot_aa.ll
callslot_deref.ll
callslot_throw.ll
capturing-func.ll
crash.ll
fca2memcpy.ll Merge clang's isRepeatedBytePattern with LLVM's isBytewiseValue 2018-09-21 05:17:42 +00:00
form-memset.ll
invariant.start.ll
lifetime.ll
load-store-to-memcpy.ll
loadstore-sret.ll
memcpy-to-memset-with-lifetimes.ll
memcpy-to-memset.ll Merge clang's isRepeatedBytePattern with LLVM's isBytewiseValue 2018-09-21 05:17:42 +00:00
memcpy-undef.ll
memcpy.ll
memmove.ll
memset-memcpy-oversized.ll Reapply "[MemCpyOpt] memset->memcpy forwarding with undef tail" 2018-12-13 20:04:27 +00:00
memset-memcpy-redundant-memset.ll
memset-memcpy-to-2x-memset.ll
nontemporal.ll
pr29105.ll
process_store.ll [MemCpyOpt] Skip optimizing basic blocks not reachable from entry 2018-04-23 19:55:04 +00:00
profitable-memset.ll
smaller.ll
sret.ll