@@ -50,6 +50,16 @@ struct Unnamed {
50
50
int : 8 ;
51
51
};
52
52
53
+ struct Empty {
54
+ };
55
+
56
+ struct UnnamedOnly {
57
+ int : 8 ;
58
+ };
59
+
60
+ // CHECK-DAG: [[ConstE:@.*]] = private unnamed_addr constant %struct.Empty undef, align 1
61
+ // CHECK-DAG: [[ConstUO:@.*]] = private unnamed_addr constant %struct.UnnamedOnly undef, align 1
62
+
53
63
// Case 1: Extraneous braces get ignored in literal instantiation.
54
64
// CHECK-LABEL: define hidden void @_Z5case1v(
55
65
// CHECK-SAME: ptr dead_on_unwind noalias writable sret([[STRUCT_TWOFLOATS:%.*]]) align 1 [[AGG_RESULT:%.*]]) #[[ATTR0:[0-9]+]] {
@@ -985,3 +995,35 @@ void case18() {
985
995
void case19 (Unnamed U) {
986
996
TwoInts TI = {U, 1 };
987
997
}
998
+
999
+ // InitList with Empty Struct on LHS
1000
+ // CHECK-LABEL: case20
1001
+ // CHECK: [[E:%.*]] = alloca %struct.Empty, align 1
1002
+ // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 1 [[E]], ptr align 1 [[ConstE]], i32 1, i1 false)
1003
+ void case20 () {
1004
+ Empty E = {};
1005
+ }
1006
+
1007
+ // InitList with Empty Struct on RHS
1008
+ // CHECK-LABEL: case21
1009
+ // CHECK: [[TI:%.*]] = alloca %struct.TwoInts, align 1
1010
+ // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %TI, ptr align 1 {{.*}}, i32 8, i1 false)
1011
+ void case21 (Empty E) {
1012
+ TwoInts TI = {E, 1 , 2 };
1013
+ }
1014
+
1015
+ // InitList with Struct with only unnamed bitfield on LHS
1016
+ // CHECK-LABEL: case22
1017
+ // CHECK: [[UO:%.*]] = alloca %struct.UnnamedOnly, align 1
1018
+ // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 1 [[UO]], ptr align 1 [[ConstUO]], i32 1, i1 false)
1019
+ void case22 () {
1020
+ UnnamedOnly UO = {};
1021
+ }
1022
+
1023
+ // InitList with Struct with only unnamed bitfield on RHS
1024
+ // CHECK-LABEL: case23
1025
+ // CHECK: [[TI:%.*]] = alloca %struct.TwoInts, align 1
1026
+ // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 1 [[TI]], ptr align 1 {{.*}}, i32 8, i1 false)
1027
+ void case23 (UnnamedOnly UO) {
1028
+ TwoInts TI = {UO, 1 , 2 };
1029
+ }
0 commit comments