@@ -68,3 +68,39 @@ -(void)setP1:(S0)s0 {
68
68
// CHECK: call void @objc_copyCppObjectAtomic({{.*}}, {{.*}}, ptr noundef @__move_assignment_8_8_s0)
69
69
// CHECK-NOT: call
70
70
// CHECK: ret void
71
+
72
+ // CHECK: define void @test0(ptr noundef %[[C:.*]], ptr noundef %[[A:.*]])
73
+ // CHECK: %[[C_ADDR:.*]] = alloca ptr, align 8
74
+ // CHECK: %[[A_ADDR:.*]] = alloca ptr, align 8
75
+ // CHECK: %[[AGG_TMP_ENSURED:.*]] = alloca %[[STRUCT_S0]], align 8
76
+ // CHECK: %[[AGG_TMP:.*]] = alloca %[[STRUCT_S0]], align 8
77
+ // CHECK: store ptr null, ptr %[[C_ADDR]], align 8
78
+ // CHECK: call void @llvm.objc.storeStrong(ptr %[[C_ADDR]], ptr %[[C]])
79
+ // CHECK: store ptr %[[A]], ptr %[[A_ADDR]], align 8
80
+ // CHECK: %[[V0:.*]] = load ptr, ptr %[[A_ADDR]], align 8
81
+ // CHECK: call void @__copy_constructor_8_8_s0(ptr %[[AGG_TMP_ENSURED]], ptr %[[V0]])
82
+ // CHECK: %[[V1:.*]] = load ptr, ptr %[[C_ADDR]], align 8
83
+ // CHECK: call void @__copy_constructor_8_8_s0(ptr %[[AGG_TMP]], ptr %[[AGG_TMP_ENSURED]])
84
+ // CHECK: %[[V2:.*]] = icmp eq ptr %[[V1]], null
85
+ // CHECK: br i1 %[[V2]], label %[[MSGSEND_NULL:.*]], label %[[MSGSEND_CALL:.*]]
86
+
87
+ // CHECK: [[MSGSEND_CALL]]:
88
+ // CHECK: %[[V3:.*]] = load ptr, ptr @OBJC_SELECTOR_REFERENCES_, align 8
89
+ // CHECK: %[[COERCE_DIVE:.*]] = getelementptr inbounds %[[STRUCT_S0]], ptr %[[AGG_TMP]], i32 0, i32 0
90
+ // CHECK: %[[V4:.*]] = load ptr, ptr %[[COERCE_DIVE]], align 8
91
+ // CHECK: %[[COERCE_VAL_PI:.*]] = ptrtoint ptr %[[V4]] to i64
92
+ // CHECK: call void @objc_msgSend(ptr noundef %[[V1]], ptr noundef %[[V3]], i64 %[[COERCE_VAL_PI]])
93
+ // CHECK: br label %[[MSGSEND_CONT:.*]]
94
+
95
+ // CHECK: [[MSGSEND_NULL]]:
96
+ // CHECK: call void @__destructor_8_s0(ptr %[[AGG_TMP]])
97
+ // CHECK: br label %[[MSGSEND_CONT]]
98
+
99
+ // CHECK: [[MSGSEND_CONT]]:
100
+ // CHECK: call void @__destructor_8_s0(ptr %[[AGG_TMP_ENSURED]]
101
+ // CHECK: call void @llvm.objc.storeStrong(ptr %[[C_ADDR]], ptr null)
102
+ // CHECK: ret void
103
+
104
+ void test0 (C *c, S0 *a) {
105
+ c.atomic0 = *a;
106
+ }
0 commit comments