[PATCH] D53843: [COFF, ARM64] Make sure to forward arguments from vararg to musttail vararg

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 29 16:26:57 PDT 2018


rnk added inline comments.


================
Comment at: lib/Target/AArch64/AArch64ISelLowering.cpp:3152
+
+    if (IsWin64 && MFI.hasMustTailInVarArgFunc()) {
+      SmallVector<MVT, 2> RegParmTypes;
----------------
Please do this for all OSs, not just windows. This is a general purpose feature that is supposed to work for all targets, it's just only implemented for one right now.


================
Comment at: lib/Target/AArch64/AArch64ISelLowering.cpp:3158
+        FuncInfo->getForwardedMustTailRegParms();
+      CCInfo.analyzeMustTailForwardedRegisters(Forwards, RegParmTypes, CC_AArch64_AAPCS);
+    }
----------------
Neat, I guess the code I wrote to find all the remaining regparms was generic enough to work for any convention.


================
Comment at: lib/Target/AArch64/AArch64ISelLowering.cpp:3622
 
+  if (IsWin64 && IsVarArg && CLI.CS && CLI.CS.isMustTailCall()) {
+    const auto &Forwards = FuncInfo->getForwardedMustTailRegParms();
----------------
Please remove the `IsWin64` test so we just do this all the time. One day, someone will come asking to use this on AArch64, probably.


================
Comment at: test/CodeGen/AArch64/vararg-tallcall.ll:1
+; RUN: llc -mtriple=aarch64-windows-msvc %s -o - | FileCheck %s
+
----------------
If it works, test some other targets, especially if the default calling convention changes based on OS.


Repository:
  rL LLVM

https://reviews.llvm.org/D53843





More information about the llvm-commits mailing list