================
@@ -93,3 +93,27 @@ void f3() {
// OGCG: %[[O:.*]] = alloca %struct.Outer, align 4
// OGCG: %[[O_I:.*]] = getelementptr inbounds nuw %struct.Outer, ptr %[[O]],
i32 0, i32 0
// OGCG: %[[O_I_N:.*]] = getelementptr inbounds nuw %struct.Inner, ptr
%[[O_I]], i32 0, i32 0
+
+void choose_expr() {
+ CompleteS a;
+ CompleteS b;
+ CompleteS c = __builtin_choose_expr(true, a, b);
+}
+
+// CIR: cir.func{{.*}} @_Z11choose_exprv()
+// CIR: %[[A_ADDR:.*]] = cir.alloca !rec_CompleteS,
!cir.ptr<!rec_CompleteS>, ["a"]
+// CIR: %[[B_ADDR:.*]] = cir.alloca !rec_CompleteS,
!cir.ptr<!rec_CompleteS>, ["b"]
+// CIR: %[[C_ADDR:.*]] = cir.alloca !rec_CompleteS,
!cir.ptr<!rec_CompleteS>, ["c", init]
+// CIR: cir.call @_ZN9CompleteSC1ERKS_(%[[C_ADDR]], %[[A_ADDR]]) nothrow :
(!cir.ptr<!rec_CompleteS>, !cir.ptr<!rec_CompleteS>) -> ()
----------------
andykaylor wrote:
Can you add a comment somewhere that this should be replaced by `cir.copy` and
maybe create an iffue to track it? The incubator does that in LoweringPrepare,
but I'm not sure why we are generating a call to a default trivial copy
constructor at all.
https://github.com/llvm/llvm-project/pull/160999
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits