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

Matt Devereau via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 10 04:25:12 PDT 2022


MattDevereau added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp:69-72
 bool AArch64RegisterInfo::hasSVEArgsOrReturn(const MachineFunction *MF) {
-  const Function &F = MF->getFunction();
-  return isa<ScalableVectorType>(F.getReturnType()) ||
-         any_of(F.args(), [](const Argument &Arg) {
-           return isa<ScalableVectorType>(Arg.getType());
-         });
+  return (MF->getInfo<AArch64FunctionInfo>()->isSVE() ||
+          isa<ScalableVectorType>(MF->getFunction().getReturnType()));
 }
----------------
paulwalker-arm wrote:
> Does `AArch64FunctionInfo` contain all the information we need?  It looks like it contains a `MachineFunction *`. I ask because I'm wondering if we can just get rid of `AArch64RegisterInfo::hasSVEArgsOrReturn` entirely.
`AArch64TargetLowering::isEligibleForTailCallOptimization` and `AArch64AsmPrinter::emitFunctionEntryLabel()` also use `AArch64RegisterInfo::hasSVEArgsOrReturn`. As `AArch64FunctionInfo` has a reference to a machine function, it should be possible to move `isa<ScalableVectorType>(MF->getFunction().getReturnType())` into the new `AArch64FunctionInfo::IsSVE` method.

So yes, I do think `AArch64FunctionInfo` has all the information we need


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