[llvm] [AArch64] Skip storing of stack arguments when lowering tail calls (PR #126735)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon May 19 05:04:50 PDT 2025


================
@@ -8968,6 +8968,46 @@ getSMToggleCondition(const SMECallAttrs &CallAttrs) {
   llvm_unreachable("Unsupported attributes");
 }
 
+/// Check whether a stack argument requires lowering in a tail call.
+static bool shouldLowerTailCallStackArg(const MachineFunction &MF,
+                                        const CCValAssign &VA, SDValue Arg,
+                                        ISD::ArgFlagsTy Flags, int CallOffset) {
+  // FIXME: We should be able to handle this case, but it's not clear how to.
+  if (Flags.isZExt() || Flags.isSExt())
+    return true;
+
+  for (;;) {
+    // Look through nodes that don't alter the bits of the incoming value.
+    unsigned Op = Arg.getOpcode();
+    if (Op == ISD::ZERO_EXTEND || Op == ISD::ANY_EXTEND || Op == ISD::BITCAST ||
+        Op == ISD::AssertZext || Op == ISD::AssertSext ||
+        Op == AArch64ISD::ASSERT_ZEXT_BOOL) {
----------------
arsenm wrote:

We have an ever growing set of Assert* nodes (e.g. this will miss the new AssertKnownFPClass). If we don't have a helper to skip these, we should have one 

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


More information about the llvm-commits mailing list