@@ -93,3 +93,39 @@ void f3() {
93
93
// OGCG: %[[O:.*]] = alloca %struct.Outer, align 4
94
94
// OGCG: %[[O_I:.*]] = getelementptr inbounds nuw %struct.Outer, ptr %[[O]], i32 0, i32 0
95
95
// OGCG: %[[O_I_N:.*]] = getelementptr inbounds nuw %struct.Inner, ptr %[[O_I]], i32 0, i32 0
96
+
97
+ void paren_expr () {
98
+ struct Point {
99
+ int x;
100
+ int y;
101
+ };
102
+
103
+ Point a = (Point{});
104
+ Point b = (a);
105
+ }
106
+
107
+ // CIR: cir.func{{.*}} @_Z10paren_exprv()
108
+ // CIR: %[[A_ADDR:.*]] = cir.alloca !rec_Point, !cir.ptr<!rec_Point>, ["a", init]
109
+ // CIR: %[[B_ADDR:.*]] = cir.alloca !rec_Point, !cir.ptr<!rec_Point>, ["b", init]
110
+ // CIR: %[[X_ELEM_PTR:.*]] = cir.get_member %[[A_ADDR]][0] {name = "x"} : !cir.ptr<!rec_Point> -> !cir.ptr<!s32i>
111
+ // CIR: %[[CONST_0:.*]] = cir.const #cir.int<0> : !s32i
112
+ // CIR: cir.store{{.*}} %[[CONST_0]], %[[X_ELEM_PTR]] : !s32i, !cir.ptr<!s32i>
113
+ // CIR: %[[Y_ELEM_PTR:.*]] = cir.get_member %[[A_ADDR]][1] {name = "y"} : !cir.ptr<!rec_Point> -> !cir.ptr<!s32i>
114
+ // CIR: %[[CONST_0:.*]] = cir.const #cir.int<0> : !s32i
115
+ // CIR: cir.store{{.*}} %[[CONST_0]], %[[Y_ELEM_PTR]] : !s32i, !cir.ptr<!s32i>
116
+ // CIR: cir.call @_ZZ10paren_exprvEN5PointC1ERKS_(%[[B_ADDR]], %[[A_ADDR]]) nothrow : (!cir.ptr<!rec_Point>, !cir.ptr<!rec_Point>) -> ()
117
+
118
+ // LLVM: define{{.*}} void @_Z10paren_exprv()
119
+ // LLVM: %[[A_ADDR:.*]] = alloca %struct.Point, i64 1, align 4
120
+ // LLVM: %[[B_ADDR:.*]] = alloca %struct.Point, i64 1, align 4
121
+ // LLVM: %[[X_ELEM_PTR:.*]] = getelementptr %struct.Point, ptr %[[A_ADDR]], i32 0, i32 0
122
+ // LLVM: store i32 0, ptr %[[X_ELEM_PTR]], align 4
123
+ // LLVM: %[[Y_ELEM_PTR:.*]] = getelementptr %struct.Point, ptr %[[A_ADDR]], i32 0, i32 1
124
+ // LLVM: store i32 0, ptr %[[Y_ELEM_PTR]], align 4
125
+ // LLVM: call void @_ZZ10paren_exprvEN5PointC1ERKS_(ptr %[[B_ADDR]], ptr %[[A_ADDR]])
126
+
127
+ // OGCG: define{{.*}} void @_Z10paren_exprv()
128
+ // OGCG: %[[A_ADDR:.*]] = alloca %struct.Point, align 4
129
+ // OGCG: %[[B_ADDR:.*]] = alloca %struct.Point, align 4
130
+ // OGCG: call void @llvm.memset.p0.i64(ptr align 4 %[[A_ADDR]], i8 0, i64 8, i1 false)
131
+ // OGCG: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %[[B_ADDR]], ptr align 4 %[[A_ADDR]], i64 8, i1 false)
0 commit comments