diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-02-03 23:04:06 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-02-03 23:04:06 +0000 |
commit | fd1e739a442b09a3f84eedfffda10b2263d76faa (patch) | |
tree | 5c84bb749b6375cbbf3040bbf663b5e553216633 /clang/test/CodeGenCXX/copy-constructor-elim.cpp | |
parent | 2a96704b339699d60dd8849b4a73f4e133879354 (diff) | |
download | bcm5719-llvm-fd1e739a442b09a3f84eedfffda10b2263d76faa.tar.gz bcm5719-llvm-fd1e739a442b09a3f84eedfffda10b2263d76faa.zip |
CodeGen: Copy-ctorm must obey the destination's alignment requirement
We would synthesize memcpy intrinsics when emitting calls to trivial C++
constructors but we wouldn't take into account the alignment of the
destination.
llvm-svn: 228061
Diffstat (limited to 'clang/test/CodeGenCXX/copy-constructor-elim.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/copy-constructor-elim.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/copy-constructor-elim.cpp b/clang/test/CodeGenCXX/copy-constructor-elim.cpp index 8e9bee97377..d82af28655c 100644 --- a/clang/test/CodeGenCXX/copy-constructor-elim.cpp +++ b/clang/test/CodeGenCXX/copy-constructor-elim.cpp @@ -43,3 +43,17 @@ int main() { S s; Call(s); } + +struct V { + int x; +}; + +typedef V V_over_aligned __attribute((aligned(8))); +extern const V_over_aligned gv1 = {}; + +extern "C" V f() { return gv1; } + +// Make sure that we obey the destination's alignment requirements when emitting +// the copy. +// CHECK-LABEL: define i32 @f() +// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64({{.*}}, i8* bitcast (%struct.V* @gv1 to i8*), i64 4, i32 4, i1 false) |