[clang] [CIR] Add support for __SVCount (PR #245456)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 25 08:57:37 PST 2026


================
@@ -102,14 +102,16 @@ static mlir::InFlightDiagnostic emitTypeConversionError(mlir::Location loc,
 /// Alignment to use for a memory access whose op carries no explicit alignment.
 /// For _BitInt the storage integer iM's ABI alignment (e.g. i128's 16)
 /// over-aligns the value, so use the _BitInt language alignment (e.g. 8).
+/// An SVE count lowers to target("aarch64.svcount"), which the MLIR data
+/// layout cannot size, so it also uses its language alignment.
 static uint64_t getMemoryFallbackAlignment(mlir::Operation *op,
                                            mlir::Type cirType,
                                            mlir::Type llvmMemType,
                                            const mlir::DataLayout &dataLayout) {
-  if (auto intTy = mlir::dyn_cast<cir::IntType>(cirType);
-      intTy && intTy.isBitInt())
+  auto intTy = mlir::dyn_cast<cir::IntType>(cirType);
+  if ((intTy && intTy.isBitInt()) || mlir::isa<cir::SveCountType>(cirType))
----------------
erichkeane wrote:

This is awkward... I am OK with it, but wonder if it is worth considering just doing 2 separate 'if' statements that end up having the same body.

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


More information about the cfe-commits mailing list