Fix function prolog codegen whe coerce-to type is a struct.
This changes function prolog in such a way as to avoid out-of-bounds
stack store in the case when coerce-to type has a larger storage size
than the real argument type.
Fixes PR11905.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150238 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGen/arm-arguments.c b/test/CodeGen/arm-arguments.c
index 3ae3b8e..6b9f350 100644
--- a/test/CodeGen/arm-arguments.c
+++ b/test/CodeGen/arm-arguments.c
@@ -153,3 +153,15 @@
// AAPCS: define arm_aapcscc void @f30({{.*}} noalias sret
struct s30 { _Complex int f0; };
struct s30 f30() {}
+
+// PR11905
+struct s31 { char x; };
+void f31(struct s31 s) { }
+// AAPCS: @f31([1 x i32] %s.coerce)
+// AAPCS: %s = alloca %struct.s31, align 4
+// AAPCS: %tmp = alloca [1 x i32]
+// AAPCS: store [1 x i32] %s.coerce, [1 x i32]* %tmp
+// APCS-GNU: @f31([1 x i32] %s.coerce)
+// APCS-GNU: %s = alloca %struct.s31, align 4
+// APCS-GNU: %tmp = alloca [1 x i32]
+// APCS-GNU: store [1 x i32] %s.coerce, [1 x i32]* %tmp