diff --git a/src/coreclr/jit/codegencommon.cpp b/src/coreclr/jit/codegencommon.cpp index 1bb99f7c9be936..27394d615167d6 100644 --- a/src/coreclr/jit/codegencommon.cpp +++ b/src/coreclr/jit/codegencommon.cpp @@ -2526,8 +2526,8 @@ regMaskTP CodeGenInterface::genGetGSCookieTempRegs(bool tailCall) // leaves rax, r10, r11. rax and r11 are used for indirection cells, so we pick r10. return RBM_R10; } - // Otherwise on x64 (win-x64 and SysV) r8 is never used for return values - return RBM_R8; + // Otherwise on x64 (win-x64, SysV and Swift) r9 is never used for return values + return RBM_R9; #elif TARGET_X86 assert(!tailCall); // On x86 it's more difficult: we have only eax, ecx and edx available as volatile diff --git a/src/coreclr/jit/morph.cpp b/src/coreclr/jit/morph.cpp index 7fe99b09006034..48493499ff22b3 100644 --- a/src/coreclr/jit/morph.cpp +++ b/src/coreclr/jit/morph.cpp @@ -1773,7 +1773,7 @@ void CallArgs::AddFinalArgsAndDetermineABIInfo(Compiler* comp, GenTreeCall* call InsertAfterThisOrFirst(comp, NewCallArg::Primitive(arg).WellKnown(WellKnownArg::PInvokeCookie)); // put destination into R10/EAX arg = comp->gtClone(call->gtCallAddr, true); - // On x64 the pinvoke target is passed in r11 which is the same + // On x64 the pinvoke target is passed in r10 which is the same // register as the gs cookie check may use. That would be a problem if // this was a tailcall, but we do not tailcall functions with // non-standard added args except indirection cells currently.