[llvm] [GlobalISel][AArch64] Tail call libcalls. (PR #74929)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 11 00:02: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; });
+}
----------------
arsenm wrote:
Shouldn't this be using CCState::resultsCompatible? Exact type match is more conservative than necessary
https://github.com/llvm/llvm-project/pull/74929
More information about the llvm-commits
mailing list