[llvm] [AArch64] Fix return address auth in swiftasync epilogues (PR #189484)

Oskar Wirga via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 5 16:55:27 PDT 2026


oskarwirga wrote:

> @oskarwirga I'd like to duplicate the question from [#189474 (comment)](https://github.com/llvm/llvm-project/pull/189474#issuecomment-4185412919) here.
> 
> Could you please share a swift reproducer (with compiler invocation command) which previously resulted in such a failing return address authentication and which becomes fixed with this PR applied?

I was fortunate to have had a swift reproducer in a smaller test app from the main app I was testing:
```swift
import Foundation

@inline(never)
public func triggerTailCallFPDiff(items: Set<String>) async throws {
    try await withThrowingTaskGroup(of: Void.self) { group in
        for item in items {
            group.addTask {
                try await Task.sleep(nanoseconds: 1_000_000)
                _ = item
            }
        }
        try await group.waitForAll()
    }
}
```

If you run:
```
xcrun swiftc -target arm64e-apple-ios17.0 -O -S -parse-as-library repro.swift -sdk $(xcrun --sdk iphoneos  --show-sdk-path)
```

you will see the adjustment of SP right before an `autibsp` like:
```asm
	ldp	x29, x30, [sp, #32]
	ldp	x21, x19, [sp, #8]
	and	x29, x29, #0xefffffffffffffff
	add	sp, sp, #48
	autibsp
```

https://github.com/llvm/llvm-project/pull/189484


More information about the llvm-commits mailing list