When building constant structs, check if the resulting LLVM struct will be bigger than the record layout size and use a packed struct if that's the case. Fixes PR5108.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83230 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGen/const-init.c b/test/CodeGen/const-init.c
index 278d84f..13bfcd9 100644
--- a/test/CodeGen/const-init.c
+++ b/test/CodeGen/const-init.c
@@ -1,4 +1,4 @@
-// RUN: clang-cc -triple i386-pc-linux-gnu -verify -emit-llvm -o %t %s &&
+// RUN: clang-cc -triple i386-pc-linux-gnu -verify -emit-llvm -o %t %s | FileCheck %s --input-file=%t &&
 
 #include <stdint.h>
 
@@ -47,6 +47,12 @@
 // RUN: grep '@g10 = global i32 0' %t &&
 int g10 = (2.0 + 3.0i) * (5.0 + 7.0i) != (-11.0 + 29.0i);
 
+// PR5108
+// CHECK: @ss = global %4 <{ i32 0, i8 7 }>, align 1
+struct s {
+  unsigned long a;
+  unsigned long b:3;
+} __attribute__((__packed__)) ss  = { .a = 0x0, .b = 7,  };
 
 // Global references
 // RUN: grep '@g11.l0 = internal global i32 ptrtoint (i32 ()\* @g11 to i32)' %t &&