[llvm] ae99a75 - [llvm][aarch64] MachO platforms do not use .seh_ (#176456)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 16 12:44:19 PST 2026
Author: Jon Roelofs
Date: 2026-01-16T20:44:14Z
New Revision: ae99a75f5eae70a463a7d1162fc3ed7ff34320f9
URL: https://github.com/llvm/llvm-project/commit/ae99a75f5eae70a463a7d1162fc3ed7ff34320f9
DIFF: https://github.com/llvm/llvm-project/commit/ae99a75f5eae70a463a7d1162fc3ed7ff34320f9.diff
LOG: [llvm][aarch64] MachO platforms do not use .seh_ (#176456)
Added:
Modified:
llvm/lib/Target/AArch64/AArch64PrologueEpilogue.cpp
llvm/test/CodeGen/AArch64/seh-minimal-prologue-epilogue.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/AArch64/AArch64PrologueEpilogue.cpp b/llvm/lib/Target/AArch64/AArch64PrologueEpilogue.cpp
index 98284a211c94a..1008c5a3ef86a 100644
--- a/llvm/lib/Target/AArch64/AArch64PrologueEpilogue.cpp
+++ b/llvm/lib/Target/AArch64/AArch64PrologueEpilogue.cpp
@@ -641,7 +641,7 @@ void AArch64PrologueEmitter::emitPrologue() {
// the epilogue. In this case, we still need to emit a SEH prologue sequence.
// See `seh-minimal-prologue-epilogue.ll` test cases.
if (AFI->getArgumentStackToRestore())
- HasWinCFI = true;
+ HasWinCFI |= NeedsWinCFI;
if (AFI->shouldSignReturnAddress(MF)) {
// If pac-ret+leaf is in effect, PAUTH_PROLOGUE pseudo instructions
diff --git a/llvm/test/CodeGen/AArch64/seh-minimal-prologue-epilogue.ll b/llvm/test/CodeGen/AArch64/seh-minimal-prologue-epilogue.ll
index cc71b8b3065ad..eb9fac013000d 100644
--- a/llvm/test/CodeGen/AArch64/seh-minimal-prologue-epilogue.ll
+++ b/llvm/test/CodeGen/AArch64/seh-minimal-prologue-epilogue.ll
@@ -1,4 +1,5 @@
-; RUN: llc -mtriple=aarch64-windows %s -o - | FileCheck %s
+; RUN: llc -mtriple=aarch64-windows %s -o - | FileCheck %s --check-prefixes=CHECK,WIN
+; RUN: llc -mtriple=arm64-apple-ios %s -o - | FileCheck %s --check-prefixes=CHECK,IOS --implicit-check-not=.seh
; This test verifies that functions requiring Windows CFI that have minimal
; or no prologue instructions still emit proper SEH directives, specifically
@@ -8,7 +9,7 @@
; calling convention would fail with:
; "error: starting epilogue (.seh_startepilogue) before prologue has ended (.seh_endprologue)"
-; Test 1: Swift-style tail call function with minimal prologue
+; Swift-style tail call function with minimal prologue
define swifttailcc void @test_swifttailcc_minimal(ptr %async_ctx, ptr %arg1, ptr %arg2) {
; CHECK-LABEL: test_swifttailcc_minimal:
; CHECK-NOT: .seh_proc test_swifttailcc_minimal
@@ -25,14 +26,15 @@ entry:
ret void
}
-; Test 2: Function similar to the original failing case
+; Function similar to the original failing case
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) {
; CHECK-LABEL: test_linkonce_swifttailcc:
-; CHECK-NEXT: .seh_proc
-; CHECK: .seh_endprologue
-; CHECK: .seh_startepilogue
-; CHECK: .seh_endepilogue
-; CHECK: .seh_endproc
+; IOS-NEXT: .cfi_startproc
+; WIN-NEXT: .seh_proc
+; WIN: .seh_endprologue
+; WIN: .seh_startepilogue
+; WIN: .seh_endepilogue
+; WIN: .seh_endproc
entry:
%frame_ptr = getelementptr inbounds nuw i8, ptr %async_ctx, i64 16
%ctx1 = getelementptr inbounds nuw i8, ptr %async_ctx, i64 400
More information about the llvm-commits
mailing list