[PATCH] D127209: [SVE][AArch64] Refine hasSVEArgsOrReturn

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 15 14:59:06 PDT 2022


efriedma added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h:199
+    return HasSVEArgs ||
+           isa<ScalableVectorType>(MF.getFunction().getReturnType());
+  };
----------------
MattDevereau wrote:
> efriedma wrote:
> > Hmm... actually, looking at this again, I'm a little concerned about checking the IR return type directly, instead of using AnalyzeReturn.  I'm not sure if this actually comes up in practice, but calling convention lowering does various transforms on the return type.  Maybe if you write something silly like "<vscale x 1000 x double>".
> > 
> > Maybe we can add a bit of code to LowerFormalArguments to also check the return type?
> Modifying test `@sve_caller_sve_callee()` in `sve-tailcall.ll` to use return type `<vscale x 1000 x double>` caused the output "LLVM ERROR: Invalid size request on a scalable vector.".
> 
> In similar fashion to the changes in LowerFormalArguments, I checked the types of the return values in `AArch64TargetLowering::LowerReturn` instead of checking the IR return type directly. This ends up passing on the rest of the tests except `sve_caller_sve_callee` and `sve_caller_sve_callee_fastcc`, where the return type is not eligible for tail optimization and the frame-pointer is incorrectly unpreserved. Is directly checking the IR return type in `AArch64TargetLowering::LowerReturn` after `AnalyzeReturn` still not sufficient?
> 
> 
> 
> 
I don't think we call AArch64TargetLowering::LowerReturn for all functions, in general, only functions that return.  We need to do the computation somewhere that's called for every function.

Besides my `<vscale x 1000 x double>` example, I don't have any specific cases where just checking `isa<ScalableVectorType>` doesn't work, but I'd like to avoid falling out of sync if we do ever add support for, for example, returning fixed-width vectors in SVE registers.

> Modifying test @sve_caller_sve_callee() in sve-tailcall.ll to use return type <vscale x 1000 x double> caused the output "LLVM ERROR: Invalid size request on a scalable vector.".

That sounds like a bug we should fix.  Although maybe not a high priority one.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127209/new/

https://reviews.llvm.org/D127209



More information about the llvm-commits mailing list