diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2012-08-23 03:10:17 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2012-08-23 03:10:17 +0000 |
| commit | a5dd5684dc508c9181244fabf7a99a6301b6d230 (patch) | |
| tree | 9d650b52a0a0b8062bfe6975b25c7df187b8a16c /clang/test/CodeGen | |
| parent | 1e774bc8350f17557493af21ea1c4dc90543c902 (diff) | |
| download | bcm5719-llvm-a5dd5684dc508c9181244fabf7a99a6301b6d230.tar.gz bcm5719-llvm-a5dd5684dc508c9181244fabf7a99a6301b6d230.zip | |
Use the alignment from lvalue emission to more accurately compute the alignment
of a pointer for builtin emission, instead of just depending on the type of the
pointee. <rdar://problem/11314941>.
llvm-svn: 162425
Diffstat (limited to 'clang/test/CodeGen')
| -rw-r--r-- | clang/test/CodeGen/builtin-memfns.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/CodeGen/builtin-memfns.c b/clang/test/CodeGen/builtin-memfns.c index 72d340619f3..4a06160ccbc 100644 --- a/clang/test/CodeGen/builtin-memfns.c +++ b/clang/test/CodeGen/builtin-memfns.c @@ -63,3 +63,23 @@ int test7(int *p) { __builtin_memset(hwparams, 0, 256); // No crash alignment = 1 // CHECK: call void @llvm.memset{{.*}}256, i32 1, i1 false) } + +// <rdar://problem/11314941> +// Make sure we don't over-estimate the alignment of fields of +// packed structs. +struct PS { + int modes[4]; +} __attribute__((packed)); +struct PS ps; +void test8(int *arg) { + // CHECK: @test8 + // CHECK: call void @llvm.memcpy{{.*}} 16, i32 1, i1 false) + __builtin_memcpy(arg, ps.modes, sizeof(struct PS)); +} + +__attribute((aligned(16))) int x[4], y[4]; +void test9() { + // CHECK: @test9 + // CHECK: call void @llvm.memcpy{{.*}} 16, i32 16, i1 false) + __builtin_memcpy(x, y, sizeof(y)); +} |

