Skip to content

Commit 849edca

Browse files
authored
[CIR] Backport Array of complex type (#1680)
Backport creating Array type with ComplexType as element type
1 parent e90e366 commit 849edca

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

clang/lib/CIR/CodeGen/CIRGenBuilder.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,8 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
529529

530530
bool isSized(mlir::Type ty) {
531531
if (mlir::isa<cir::PointerType, cir::RecordType, cir::ArrayType,
532-
cir::BoolType, cir::IntType, cir::CIRFPTypeInterface>(ty))
532+
cir::BoolType, cir::IntType, cir::CIRFPTypeInterface,
533+
cir::ComplexType>(ty))
533534
return true;
534535
if (mlir::isa<cir::VectorType>(ty)) {
535536
return isSized(mlir::cast<cir::VectorType>(ty).getElementType());

clang/test/CIR/CodeGen/array.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,7 @@ void testPointerDecayedArrayMultiDimSubscriptAccess(int arr[][3]) {
9090
// CHECK: %[[#V5:]] = cir.cast(array_to_ptrdecay, %[[#V3]] : !cir.ptr<!cir.array<!s32i x 3>>), !cir.ptr<!s32i>
9191
// CHECK: cir.ptr_stride(%[[#V5]] : !cir.ptr<!s32i>, %[[#V4]] : !s32i), !cir.ptr<!s32i>
9292
}
93+
94+
void testArrayOfComplexType() { int _Complex a[4]; }
95+
96+
// CHECK: %[[ARR:.*]] = cir.alloca !cir.array<!cir.complex<!s32i> x 4>, !cir.ptr<!cir.array<!cir.complex<!s32i> x 4>>, ["a"]

0 commit comments

Comments
 (0)