@@ -129,3 +129,28 @@ void paren_expr() {
129129// OGCG: %[[B_ADDR:.*]] = alloca %struct.Point, align 4
130130// OGCG: call void @llvm.memset.p0.i64(ptr align 4 %[[A_ADDR]], i8 0, i64 8, i1 false)
131131// OGCG: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %[[B_ADDR]], ptr align 4 %[[A_ADDR]], i64 8, i1 false)
132+
133+ void choose_expr () {
134+ CompleteS a;
135+ CompleteS b;
136+ CompleteS c = __builtin_choose_expr (true , a, b);
137+ }
138+
139+ // CIR: cir.func{{.*}} @_Z11choose_exprv()
140+ // CIR: %[[A_ADDR:.*]] = cir.alloca !rec_CompleteS, !cir.ptr<!rec_CompleteS>, ["a"]
141+ // CIR: %[[B_ADDR:.*]] = cir.alloca !rec_CompleteS, !cir.ptr<!rec_CompleteS>, ["b"]
142+ // CIR: %[[C_ADDR:.*]] = cir.alloca !rec_CompleteS, !cir.ptr<!rec_CompleteS>, ["c", init]
143+ // TODO(cir): Call to default copy constructor should be replaced by `cir.copy` op
144+ // CIR: cir.call @_ZN9CompleteSC1ERKS_(%[[C_ADDR]], %[[A_ADDR]]) nothrow : (!cir.ptr<!rec_CompleteS>, !cir.ptr<!rec_CompleteS>) -> ()
145+
146+ // LLVM: define{{.*}} void @_Z11choose_exprv()
147+ // LLVM: %[[A_ADDR:.*]] = alloca %struct.CompleteS, i64 1, align 4
148+ // LLVM: %[[B_ADDR:.*]] = alloca %struct.CompleteS, i64 1, align 4
149+ // LLVM: %[[C_ADDR:.*]] = alloca %struct.CompleteS, i64 1, align 4
150+ // LLVM: call void @_ZN9CompleteSC1ERKS_(ptr %[[C_ADDR]], ptr %[[A_ADDR]])
151+
152+ // OGCG: define{{.*}} void @_Z11choose_exprv()
153+ // OGCG: %[[A_ADDR:.*]] = alloca %struct.CompleteS, align 4
154+ // OGCG: %[[B_ADDR:.*]] = alloca %struct.CompleteS, align 4
155+ // OGCG: %[[C_ADDR:.*]] = alloca %struct.CompleteS, align 4
156+ // OGCG: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %[[C_ADDR]], ptr align 4 %[[A_ADDR]], i64 8, i1 false)
0 commit comments