[clang] [CIR] Support ComplexType in CallExpr args (PR #156236)

Amr Hesham via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 3 11:22:00 PDT 2025


================
@@ -909,3 +909,46 @@ void foo33(__builtin_va_list a) {
 // OGCG:  %[[B_IMAG_PTR:.*]] = getelementptr inbounds nuw { float, float }, ptr %[[B_ADDR]], i32 0, i32 1
 // OGCG:  store float %[[RESULT_REAL]], ptr %[[B_REAL_PTR]], align 4
 // OGCG:  store float %[[RESULT_IMAG]], ptr %[[B_IMAG_PTR]], align 4
+
+void foo34(float _Complex a) {}
+
+// CIR: %[[A_ADDR:.*]] = cir.alloca !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>, ["a", init]
+// CIR: cir.store %{{.*}}, %[[A_ADDR]] : !cir.complex<!cir.float>, !cir.ptr<!cir.complex<!cir.float>>
+
+// LLVM: %[[A_ADDR:.*]] = alloca { float, float }, i64 1, align 4
+// LLVM: store { float, float } %{{.*}}, ptr %[[A_ADDR]], align 4
----------------
AmrDeveloper wrote:

> Is there any way we can detect that and emit an error?

For now, we can detect if any parameter is a complex type in `CIRGenFunction::startFunction` to report error NYI, and we can delay call expr with complex until we start call conv lowering 🤔 

https://github.com/llvm/llvm-project/pull/156236


More information about the cfe-commits mailing list