[llvm] [x86] Enable indirect tail calls with more arguments (PR #137643)

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 29 15:39:12 PDT 2025


================
@@ -1353,6 +1376,22 @@ void X86DAGToDAGISel::PreprocessISelDAG() {
          (N->getOpcode() == X86ISD::TC_RETURN &&
           (Subtarget->is64Bit() ||
            !getTargetMachine().isPositionIndependent())))) {
+
+      if (N->getOpcode() == X86ISD::TC_RETURN) {
+        // There needs to be enough non-callee-saved GPRs available to compute
+        // the load address if folded into the tailcall. See how the
+        // X86tcret_6regs and X86tcret_1reg classes are used and defined.
+        unsigned NumRegs = 0;
+        for (unsigned I = 3, E = N->getNumOperands(); I != E; ++I) {
----------------
rnk wrote:

Is there a way to avoid the magic number 3?

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


More information about the llvm-commits mailing list