[llvm] [GlobalISel][AArch64] Tail call libcalls. (PR #74929)

David Green via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 07:21:57 PST 2023


================
@@ -565,9 +566,29 @@ static RTLIB::Libcall getRTLibDesc(unsigned Opcode, unsigned Size) {
   llvm_unreachable("Unknown libcall function");
 }
 
+static bool isCompatibleForRetType(const CallLowering::ArgInfo &Result,
+                                   const MachineFunction *MF,
+                                   MachineRegisterInfo &MRI) {
+  auto &TLI = *MF->getSubtarget().getTargetLowering();
+  const Function &F = MF->getFunction();
+  const DataLayout &DL = MF->getDataLayout();
+  CallingConv::ID CC = F.getCallingConv();
+
+  // Check that the decomposed types are the same between function and the
+  // libcall.
+  SmallVector<ISD::OutputArg, 4> OutsFn;
+  GetReturnInfo(CC, F.getReturnType(), F.getAttributes(), OutsFn, TLI, DL);
+  SmallVector<ISD::OutputArg, 4> OutsLibcall;
+  GetReturnInfo(CC, Result.Ty, F.getAttributes(), OutsLibcall, TLI, DL);
+  return OutsFn.size() == OutsLibcall.size() &&
+         all_of(zip(OutsFn, OutsLibcall),
+                [](auto P) { return get<0>(P).VT == get<1>(P).VT; });
+}
----------------
davemgreen wrote:

Ah - that is what I was after. I didn't know what it was called and hadn't looked in the right place for it. Thanks.

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


More information about the llvm-commits mailing list