[clang] [CIR] Upstream basic support for ArrayType (PR #130502)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 12 13:58:10 PDT 2025
================
@@ -33,6 +33,14 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
llvm_unreachable("NYI: PPC double-double format for long double");
llvm_unreachable("Unsupported format for long double");
}
+
+ bool isSized(mlir::Type ty) {
+ if (mlir::isa<cir::PointerType, cir::ArrayType, cir::BoolType,
+ cir::IntType>(ty))
+ return true;
+ assert(0 && "Unimplemented size for type");
----------------
andykaylor wrote:
Hmm. I just looked again at the incubator implementation. I thought vector types returned false here, but they return `isSized(elementType)`, so nothing implemented there returns false without going through the assert. I compared the incubator code to the classic codegen, and the classic codegen is calling llvm::Type::isSized. Looking into that, it seems to be things like functions, labels, and target extension types that return false. So, you're right that there is something not yet implemented here, but the thing that isn't implemented is the existence of types that need special handling, so we can't even check for this being the thing that isn't implemented.
Maybe the thing to do here is get rid of `CIRGenBuilder::isSized()` completely and add `assert(!cir::MissingFeature::NonSizedTypes());` at the call site. This seems to only be used in two places in the incubator and both will have the same issue.
https://github.com/llvm/llvm-project/pull/130502
More information about the cfe-commits
mailing list