From 7c6d52b152cc81c5baf2fd6b820d140384c154f3 Mon Sep 17 00:00:00 2001 From: AmrDeveloper Date: Thu, 12 Jun 2025 22:02:53 +0200 Subject: [PATCH] [CIR] Backport Array of complex type --- clang/lib/CIR/CodeGen/CIRGenBuilder.h | 3 ++- clang/test/CIR/CodeGen/array.cpp | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/clang/lib/CIR/CodeGen/CIRGenBuilder.h b/clang/lib/CIR/CodeGen/CIRGenBuilder.h index 7208e12fec5d..adc3bc4efc50 100644 --- a/clang/lib/CIR/CodeGen/CIRGenBuilder.h +++ b/clang/lib/CIR/CodeGen/CIRGenBuilder.h @@ -529,7 +529,8 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy { bool isSized(mlir::Type ty) { if (mlir::isa(ty)) + cir::BoolType, cir::IntType, cir::CIRFPTypeInterface, + cir::ComplexType>(ty)) return true; if (mlir::isa(ty)) { return isSized(mlir::cast(ty).getElementType()); diff --git a/clang/test/CIR/CodeGen/array.cpp b/clang/test/CIR/CodeGen/array.cpp index 51e9044be202..f62a8ff49b13 100644 --- a/clang/test/CIR/CodeGen/array.cpp +++ b/clang/test/CIR/CodeGen/array.cpp @@ -90,3 +90,7 @@ void testPointerDecayedArrayMultiDimSubscriptAccess(int arr[][3]) { // CHECK: %[[#V5:]] = cir.cast(array_to_ptrdecay, %[[#V3]] : !cir.ptr>), !cir.ptr // CHECK: cir.ptr_stride(%[[#V5]] : !cir.ptr, %[[#V4]] : !s32i), !cir.ptr } + +void testArrayOfComplexType() { int _Complex a[4]; } + +// CHECK: %[[ARR:.*]] = cir.alloca !cir.array x 4>, !cir.ptr x 4>>, ["a"]