When generating IR for default copy-constructors, copy-assignment operators,
authorLang Hames <lhames@gmail.com>
Mon, 11 Feb 2013 23:44:11 +0000 (23:44 +0000)
committerLang Hames <lhames@gmail.com>
Mon, 11 Feb 2013 23:44:11 +0000 (23:44 +0000)
commit5824a4f1b0962bfe7a80d382d0ed9ce2050d3d88
tree3e8c7035e7476cda708d7f8f5d0bf184aebd6d32
parentd7fe06f274a6cf19f30e9cad88f5b7e62df1fce6
When generating IR for default copy-constructors, copy-assignment operators,
move-constructors and move-assignment operators, use memcpy to copy adjacent
POD members.

Previously, classes with one or more Non-POD members would fall back on
element-wise copies for all members, including POD members. This often
generated a lot of IR. Without padding metadata, it wasn't often possible
for the LLVM optimizers to turn the element-wise copies into a memcpy.

This code hasn't yet received any serious tuning. I didn't see any serious
regressions on a self-hosted clang build, or any of the nightly tests, but
I think it's important to get this out in the wild to get more testing.
Insights, feedback and comments welcome.

Many thanks to David Blaikie, Richard Smith, and especially John McCall for
their help and feedback on this work.

llvm-svn: 174919
clang/lib/CodeGen/CGClass.cpp
clang/lib/CodeGen/CodeGenFunction.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/test/CodeGenCXX/copy-assign-synthesis-1.cpp
clang/test/CodeGenCXX/implicit-copy-assign-operator.cpp
clang/test/CodeGenCXX/implicit-copy-constructor.cpp