[clang] [AArch64] Enable vscale_range with +sme (PR #124466)

Sander de Smalen via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 28 10:39:22 PST 2025


================
@@ -708,7 +708,7 @@ AArch64TargetInfo::getVScaleRange(const LangOptions &LangOpts) const {
     return std::pair<unsigned, unsigned>(
         LangOpts.VScaleMin ? LangOpts.VScaleMin : 1, LangOpts.VScaleMax);
 
-  if (hasFeature("sve"))
+  if (hasFeature("sve") || hasFeature("sme"))
----------------
sdesmalen-arm wrote:

If the function only has `+sme`, then `vscale_range` should only apply to (locally) streaming functions, because non-streaming or streaming-compatible functions cannot use scalable vectors.

I guess the the thing to watch out for is that we don't propagate assumptions from using `-msve-vector-bits` to streaming[-compatible] functions, because that information may be incorrect.

The SME attributes tell which mode the statements of a function must be executed in, so `vscale_range` should apply to all LLVM IR operations in the body of that function. For targets that have both SVE and SME, this may no longer be true during CodeGen because the DAG introduces streaming-mode changes for calls, and in the prologue/epilogue of locally-streaming functions. If it assumes a certain vector width for the body, the DAG might end up with instructions that assume this width for operations executed in a different mode. I've not really thought this through, but it does need further investigation if we ever want to enable that. Anyway, that doesn't really apply to this patch.



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


More information about the cfe-commits mailing list