Skip to content

Commit ec1ade0

Browse files
committed
Add comment and reduce test cases
1 parent cd010f0 commit ec1ade0

File tree

2 files changed

+5
-33
lines changed

2 files changed

+5
-33
lines changed

llvm/lib/Target/AArch64/AArch64PrologueEpilogue.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,10 @@ void AArch64PrologueEmitter::emitPrologue() {
541541
// to determine the end of the prologue.
542542
DebugLoc DL;
543543

544+
// In some cases, particularly with CallingConv::SwiftTail, it is possible to
545+
// have a tail-call where the caller only needs to adjust the stack pointer in
546+
// the epilogue. In this case, we still need to emit a SEH prologue sequence.
547+
// See `seh-minimal-prologue-epilogue.ll` test cases.
544548
if (AFI->getArgumentStackToRestore())
545549
HasWinCFI = true;
546550

llvm/test/CodeGen/AArch64/seh-minimal-prologue-epilogue.ll

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,38 +25,7 @@ entry:
2525
ret void
2626
}
2727

28-
; Test 2: Regular function with no stack frame but needs epilogue
29-
define void @test_no_stack_frame() {
30-
; CHECK-LABEL: test_no_stack_frame:
31-
; CHECK-NEXT: .seh_proc test_no_stack_frame
32-
; CHECK: .seh_endprologue
33-
; CHECK: .seh_startepilogue
34-
; CHECK: .seh_endepilogue
35-
; CHECK: .seh_endproc
36-
entry:
37-
call void @external_function()
38-
ret void
39-
}
40-
41-
; Test 3: Function with minimal stack adjustment only in epilogue
42-
define void @test_minimal_stack_adjust(ptr %ptr) {
43-
; CHECK-LABEL: test_minimal_stack_adjust:
44-
; CHECK-NEXT: .seh_proc test_minimal_stack_adjust
45-
; CHECK: .seh_endprologue
46-
; CHECK: .seh_startepilogue
47-
; CHECK: add sp, sp, #16
48-
; CHECK: .seh_stackalloc 16
49-
; CHECK: .seh_endepilogue
50-
; CHECK: .seh_endproc
51-
entry:
52-
%local = alloca i64, align 8
53-
store i64 42, ptr %local, align 8
54-
%value = load i64, ptr %local, align 8
55-
store i64 %value, ptr %ptr, align 8
56-
ret void
57-
}
58-
59-
; Test 4: Function similar to the original failing case
28+
; Test 2: Function similar to the original failing case
6029
define linkonce_odr hidden swifttailcc void @test_linkonce_swifttailcc(ptr swiftasync %async_ctx, ptr %arg1, ptr noalias dereferenceable(40) %arg2, ptr %arg3, i64 %value, ptr %arg4, ptr %arg5, ptr %arg6, i1 %flag, ptr %arg7, ptr noalias dereferenceable(40) %arg8) {
6130
; CHECK-LABEL: test_linkonce_swifttailcc:
6231
; CHECK-NEXT: .seh_proc
@@ -82,4 +51,3 @@ entry:
8251

8352
declare swifttailcc void @external_swift_function(ptr, ptr)
8453
declare swifttailcc void @external_swift_continuation(ptr swiftasync, i64, i64)
85-
declare void @external_function()

0 commit comments

Comments
 (0)