[clang] [CIR] Use target-specific maximum for vector alignment (PR #242040)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 16 09:46:56 PST 2026


================
@@ -188,6 +188,20 @@ BitIntSpecAttr::verify(function_ref<InFlightDiagnostic()> emitError,
   return success();
 }
 
+//===----------------------------------------------------------------------===//
+// VectorSpecAttr definitions
+//===----------------------------------------------------------------------===//
+
+LogicalResult
+VectorSpecAttr::verify(function_ref<InFlightDiagnostic()> emitError,
+                       uint32_t maxAlign) {
+  // TargetInfo::getMaxVectorAlign() is a power of two, at least the char
+  // width, when the target imposes a cap. Char width is 8 bits.
+  if (maxAlign < 8 || !llvm::isPowerOf2_32(maxAlign))
----------------
andykaylor wrote:

That could be useful.

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


More information about the cfe-commits mailing list