[llvm] [X86] Do not elect to tail call if caller must preserve all registers (PR #112098)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 14 12:33:00 PDT 2024
================
@@ -2856,6 +2856,14 @@ bool X86TargetLowering::IsEligibleForTailCallOptimization(
return false;
}
+ // The stack frame of the caller cannot be replaced by the tail-callee one's
+ // if the function is required to preserve all the registers. Conservatively
+ // prevent tail optimization even if hypothetically all the registers are used
+ // for passing formal parameters or returning values.
+ if (CLI.CB &&
+ CLI.CB->getFunction()->hasFnAttribute("no_caller_saved_registers"))
----------------
nikic wrote:
Can this check MF.getFunction() instead of the optional CLI.CB?
https://github.com/llvm/llvm-project/pull/112098
More information about the llvm-commits
mailing list