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

David Green via llvm-commits llvm-commits at lists.llvm.org
Tue May 27 09:36:37 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 ||
----------------
davemgreen wrote:

Bitcast can alter the bits in BE, and ZERO_EXTEND can change the bits in a way. Are they OK for this?

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


More information about the llvm-commits mailing list