Skip to content

Commit 34be9e0

Browse files
author
git apple-llvm automerger
committed
Merge commit '9fec064b8eba' from swift/release/6.1 into stable/20240723
2 parents 5fd5d15 + 9fec064 commit 34be9e0

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

llvm/lib/Target/X86/X86ISelLoweringCall.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2318,12 +2318,13 @@ X86TargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
23182318
// shuffling arguments passed in memory.
23192319
if (!IsSibcall && isTailCall) {
23202320
// Force all the incoming stack arguments to be loaded from the stack
2321-
// before any new outgoing arguments are stored to the stack, because the
2322-
// outgoing stack slots may alias the incoming argument stack slots, and
2323-
// the alias isn't otherwise explicit. This is slightly more conservative
2324-
// than necessary, because it means that each store effectively depends
2325-
// on every argument instead of just those arguments it would clobber.
2326-
SDValue ArgChain = DAG.getStackArgumentTokenFactor(Chain);
2321+
// before any new outgoing arguments or the return address are stored to the
2322+
// stack, because the outgoing stack slots may alias the incoming argument
2323+
// stack slots, and the alias isn't otherwise explicit. This is slightly
2324+
// more conservative than necessary, because it means that each store
2325+
// effectively depends on every argument instead of just those arguments it
2326+
// would clobber.
2327+
Chain = DAG.getStackArgumentTokenFactor(Chain);
23272328

23282329
SmallVector<SDValue, 8> MemOpChains2;
23292330
SDValue FIN;
@@ -2365,13 +2366,12 @@ X86TargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
23652366
Source = DAG.getNode(ISD::ADD, dl, getPointerTy(DAG.getDataLayout()),
23662367
StackPtr, Source);
23672368

2368-
MemOpChains2.push_back(CreateCopyOfByValArgument(Source, FIN,
2369-
ArgChain,
2370-
Flags, DAG, dl));
2369+
MemOpChains2.push_back(
2370+
CreateCopyOfByValArgument(Source, FIN, Chain, Flags, DAG, dl));
23712371
} else {
23722372
// Store relative to framepointer.
23732373
MemOpChains2.push_back(DAG.getStore(
2374-
ArgChain, dl, Arg, FIN,
2374+
Chain, dl, Arg, FIN,
23752375
MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), FI)));
23762376
}
23772377
}

llvm/test/CodeGen/X86/swifttailcc-store-ret-address-aliasing-stack-slot.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ define swifttailcc void @test(ptr %0, ptr swiftasync %1, i64 %2, i64 %3, ptr %4,
2424
; CHECK-NEXT: movq {{[0-9]+}}(%rsp), %r15
2525
; CHECK-NEXT: callq _foo
2626
; CHECK-NEXT: movq %r14, (%rax)
27+
; CHECK-NEXT: movl [[OFF:[0-9]+]](%rsp), %edx
2728
; CHECK-NEXT: movq {{[0-9]+}}(%rsp), %rcx
28-
; CHECK-NEXT: movq %rcx, [[OFF:[0-9]+]](%rsp)
29-
; CHECK-NEXT: movl [[OFF]](%rsp), %edx
29+
; CHECK-NEXT: movq %rcx, [[OFF]](%rsp)
3030
; CHECK-NEXT: movq %rax, %r14
3131
; CHECK-NEXT: movq %r13, %rdi
3232
; CHECK-NEXT: movq %r15, %rsi

0 commit comments

Comments
 (0)