diff options
author | John McCall <rjmccall@apple.com> | 2011-01-20 07:57:12 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-01-20 07:57:12 +0000 |
commit | ba4f5d5754c8291690d01ca9581926673d69b24c (patch) | |
tree | ba5c8463382801f9f2f55641e03278da8c565d69 /test/CodeGen/packed-structure.c | |
parent | 9eefa229dfb71400a6bbee326420a7f0e2e91f1f (diff) |
Fix the computation of alignment for fields of packed+aligned structs.
Part of the fix for PR8413.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123904 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/packed-structure.c')
-rw-r--r-- | test/CodeGen/packed-structure.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/CodeGen/packed-structure.c b/test/CodeGen/packed-structure.c index 2934d01d64..731a50bb07 100644 --- a/test/CodeGen/packed-structure.c +++ b/test/CodeGen/packed-structure.c @@ -87,3 +87,16 @@ int s2_load_y(struct s2 *a) { return a->y; } // CHECK-FUNCTIONS: define void @s2_copy // CHECK-FUNCTIONS: call void @llvm.memcpy.p0i8.p0i8.i64(i8* {{.*}}, i8* {{.*}}, i64 8, i32 2, i1 false) void s2_copy(struct s2 *a, struct s2 *b) { *b = *a; } + +struct __attribute__((packed, aligned)) s3 { + short aShort; + int anInt; +}; +// CHECK-GLOBAL: @s3_1 = global i32 2 +int s3_1 = __alignof(((struct s3*) 0)->anInt); +// CHECK-FUNCTIONS: define i32 @test3( +int test3(struct s3 *ptr) { + // CHECK-FUNCTIONS: [[PTR:%.*]] = getelementptr inbounds {{%.*}}* {{%.*}}, i32 0, i32 1 + // CHECK-FUNCTIONS-NEXT: load i32* [[PTR]], align 2 + return ptr->anInt; +} |