[llvm] [AArch64] Reject non-scalable types in named Z-register constraints (PR #217551)
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 20 03:49:41 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())
+ return std::make_pair(0U, nullptr);
+
return *P;
----------------
paulwalker-arm wrote:
```suggestion
if (VT.isScalableVector() && Subtarget->isSVEorStreamingSVEAvailable())
return *P;
return std::make_pair(0U, nullptr);
```
It feels better to explicitly return on the positive and reject everything else. It also makes it easier to add new positive returns if they ever materialise.
https://github.com/llvm/llvm-project/pull/217551
More information about the llvm-commits
mailing list