forked from OSchip/llvm-project
[AArch64] Preserve X8 for thunks ending in variadic musttail calls
Summary: On Windows, X8 may be used to pass in the address of an aggregate that is returned indirectly. Therefore, it should be forwarded to variadic musttail calls and preserved in thunks. Fixes PR41997 Reviewers: mgrang, efriedma Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62344 llvm-svn: 361585
This commit is contained in:
parent
ed595e8627
commit
b7a78c7dff
|
@ -3207,6 +3207,12 @@ SDValue AArch64TargetLowering::LowerFormalArguments(
|
|||
FuncInfo->getForwardedMustTailRegParms();
|
||||
CCInfo.analyzeMustTailForwardedRegisters(Forwards, RegParmTypes,
|
||||
CC_AArch64_AAPCS);
|
||||
|
||||
// Conservatively forward X8, since it might be used for aggregate return.
|
||||
if (!CCInfo.isAllocated(AArch64::X8)) {
|
||||
unsigned X8VReg = MF.addLiveIn(AArch64::X8, &AArch64::GPR64RegClass);
|
||||
Forwards.push_back(ForwardedRegister(X8VReg, AArch64::X8, MVT::i64));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ entry:
|
|||
attributes #1 = { noinline optnone "thunk" }
|
||||
|
||||
; CHECK: mov v16.16b, v0.16b
|
||||
; CHECK: ldr x8, [x0]
|
||||
; CHECK: ldr x8, [x8]
|
||||
; CHECK: ldr x9, [x0]
|
||||
; CHECK: ldr x9, [x9]
|
||||
; CHECK: mov v0.16b, v16.16b
|
||||
; CHECK: br x8
|
||||
; CHECK: br x9
|
||||
|
|
Loading…
Reference in New Issue