[compiler-rt] [flang] [llvm] [AArch64] fix trampoline implementation: use X15 (PR #126743)
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Tue May 20 12:07:17 PDT 2025
================
@@ -1982,6 +1982,27 @@ void AArch64FrameLowering::emitPrologue(MachineFunction &MF,
: 0;
if (windowsRequiresStackProbe(MF, NumBytes + RealignmentPadding)) {
+ // Find an available register to spill the value of X15 to, if X15 is being
+ // used already for nest.
+ unsigned X15Scratch = AArch64::NoRegister;
+ const AArch64Subtarget &STI = MF.getSubtarget<AArch64Subtarget>();
+ if (llvm::any_of(MBB.liveins(),
+ [&STI](const MachineBasicBlock::RegisterMaskPair &LiveIn) {
+ return STI.getRegisterInfo()->isSuperOrSubRegisterEq(
+ AArch64::X15, LiveIn.PhysReg);
+ })) {
+ X15Scratch = findScratchNonCalleeSaveRegister(&MBB);
----------------
efriedma-quic wrote:
We need to make sure the scratch is not x16 or x17. (See CSR_AArch64_StackProbe_Windows.)
https://github.com/llvm/llvm-project/pull/126743
More information about the llvm-commits
mailing list