diff --git a/clang/lib/CIR/CodeGen/CIRGenBuilder.h b/clang/lib/CIR/CodeGen/CIRGenBuilder.h index 47318bafcd8c..a02cdf26ee4d 100644 --- a/clang/lib/CIR/CodeGen/CIRGenBuilder.h +++ b/clang/lib/CIR/CodeGen/CIRGenBuilder.h @@ -61,11 +61,9 @@ class CIRGenBuilderTy : public CIRBaseBuilderTy { RecordNames["anon"] = 0; // in order to start from the name "anon.0" } - std::string getUniqueAnonRecordName() { - return getUniqueRecordName("anon"); - } + std::string getUniqueAnonRecordName() { return getUniqueRecordName("anon"); } - std::string getUniqueRecordName(const std::string& baseName) { + std::string getUniqueRecordName(const std::string &baseName) { auto it = RecordNames.find(baseName); if (it == RecordNames.end()) { RecordNames[baseName] = 0; @@ -500,6 +498,9 @@ class CIRGenBuilderTy : public CIRBaseBuilderTy { mlir::cir::ArrayType, mlir::cir::BoolType, mlir::cir::IntType, mlir::cir::CIRFPTypeInterface>(ty)) return true; + if (mlir::isa(ty)) { + return isSized(mlir::cast(ty).getEltType()); + } assert(0 && "Unimplemented size for type"); return false; } diff --git a/clang/test/CIR/CodeGen/vectype-issized.c b/clang/test/CIR/CodeGen/vectype-issized.c new file mode 100644 index 000000000000..380ed7a13f28 --- /dev/null +++ b/clang/test/CIR/CodeGen/vectype-issized.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -triple aarch64-none-linux-android24 -fclangir -emit-cir -target-feature +neon %s -o %t.cir +// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s +// RUN: %clang_cc1 -triple aarch64-none-linux-android24 -fclangir -emit-llvm -target-feature +neon %s -o %t.ll +// RUN: FileCheck --check-prefix=LLVM --input-file=%t.ll %s + +typedef __attribute__((neon_vector_type(8))) short c; +void d() { c a[8]; } + +// CIR-LABEL: d +// CIR: {{%.*}} = cir.alloca !cir.array x 8>, +// CIR-SAME: !cir.ptr x 8>>, ["a"] +// CIR-SAME: {alignment = 16 : i64} + +// LLVM-LABEL: d +// LLVM: {{%.*}} = alloca [8 x <8 x i16>], i64 1, align 16