[llvm] [AArch64] Reject non-scalable types in named Z-register constraints (PR #217551)

Kieran B via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 01:49:04 PDT 2026


================
@@ -14375,13 +14357,24 @@ AArch64TargetLowering::getRegForInlineAsmConstraint(
     }
   } else {
     if (const auto P = parseSVERegAsConstraint(Constraint)) {
-      // SME functions that are not in streaming mode, should
-      // still observe clobbers of Z-registers by clobbering
-      // the lower 128bits of those registers.
-      if (AArch64::ZPRRegClass.hasSubClassEq(P->second) &&
-          !Subtarget->isSVEorStreamingSVEAvailable())
-        return std::make_pair(TRI->getSubReg(P->first, AArch64::zsub),
-                              &AArch64::FPR128RegClass);
+      if (!AArch64::ZPRRegClass.hasSubClassEq(P->second))
+        return *P;
+
+      // A named Z-register constraint with MVT::Other represents an untyped
+      // clobber.
+      if (VT == MVT::Other) {
+        // SME functions that are not in streaming mode, should
+        // still observe clobbers of Z-registers by clobbering
+        // the lower 128bits of those registers.
+        if (!Subtarget->isSVEorStreamingSVEAvailable())
+          return std::make_pair(TRI->getSubReg(P->first, AArch64::zsub),
+                                &AArch64::FPR128RegClass);
+        return *P;
+      }
+
+      if (!VT.isScalableVector() || !Subtarget->isSVEorStreamingSVEAvailable())
----------------
kieroxide wrote:

I agree that the switch statement is the cleanest and most explicit option, I have modified it to use this way instead. Thanks for the suggestion.

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


More information about the llvm-commits mailing list