[PATCH] Gut InstCombiner::SimplifyMemTransfer.

Lang Hames lhames at gmail.com
Wed Apr 8 22:13:01 PDT 2015


Hi David, Chandler,

The attached patch guts the SimplifyMemTransfer method, which turns small
memcpys (1/2/4/8 bytes) into load/store pairs. Turning memcpys into
load/store pairs loses information, since we can no longer assume the
source and dest are non-overlapping. This is leading to some suboptimal
expansions for small memcpys on AArch64 when -mno-unaligned-access is
turned on (see r234462). I suspect other architectures would suffer similar
issues.

I assume this transform is an old workaround to simplify other
non-memcpy-aware IR transforms. These days I think most IR transforms can
reason sensibly about memcpys, so I'm hoping this is safe to remove. FWIW,
removing it didn't hit any regression tests except those that were
verifying that this optimisation was being applied, but then you wouldn't
really expect it to hit any others.

If this transform really is useful then we should probably revisit the
cut-off: 8-bytes isn't much these days. Perhaps we should also only apply
it if the alignment on the memcpy is sufficiently high?

Cheers,
Lang.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150408/c3ec8efa/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gut_simplifymemtransfer.patch
Type: application/octet-stream
Size: 11879 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150408/c3ec8efa/attachment.obj>


More information about the llvm-commits mailing list