From 7c3c09e23fe4b2752dbbf957d6bebbf72e7b0319 Mon Sep 17 00:00:00 2001 From: Oliver Stannard Date: Wed, 12 Mar 2014 14:02:50 +0000 Subject: ARM: Correct alignment of structs passed as byval pointer When a struct has bitfields overlapping with other members (as required by the AAPCS), clang uses a packed struct to represent this. If such a struct is large enough for clang to pass it as a byval pointer (>64 bytes), we need to set the alignment of the argument to match the original type. llvm-svn: 203660 --- clang/test/CodeGen/arm-byval-align.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 clang/test/CodeGen/arm-byval-align.c (limited to 'clang/test/CodeGen/arm-byval-align.c') diff --git a/clang/test/CodeGen/arm-byval-align.c b/clang/test/CodeGen/arm-byval-align.c new file mode 100644 index 00000000000..aa22503fe4b --- /dev/null +++ b/clang/test/CodeGen/arm-byval-align.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -triple=armv7-none-eabi < %s -S -emit-llvm | FileCheck %s + +struct foo { + long long a; + char b; + int c:16; + int d[16]; +}; + +// CHECK: %struct.foo* byval align 8 %z +long long bar(int a, int b, int c, int d, int e, + struct foo z) { + return z.a; +} -- cgit v1.2.3