[llvm] [GlobalISel][AArch64] Tail call libcalls. (PR #74929)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 14 14:04:54 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:
This might be more difficult actually, and may need to defer to the target to get the correct info it needs.
https://github.com/llvm/llvm-project/pull/74929
More information about the llvm-commits
mailing list