[llvm] [AArch64] Fix handling of x29/x30 in inline assembly clobbers (PR #167783)
David Spickett via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 17 02:13:21 PST 2025
================
@@ -0,0 +1,36 @@
+; RUN: llc -mtriple=aarch64 -verify-machineinstrs < %s | FileCheck %s
+
+; Test that both numeric register names (x29, x30) and their architectural
+; aliases (fp, lr) work correctly as clobbers in inline assembly.
+
+define void @clobber_x29() nounwind {
+; CHECK-LABEL: clobber_x29:
+; CHECK: str x29, [sp
+; CHECK: ldr x29, [sp
+ tail call void asm sideeffect "", "~{x29}"()
----------------
DavidSpickett wrote:
I know these are marked tailcall so in theory we should never get load/stores for stack frame management.
However, if you put a nop in the asm statement, you could make this into:
CHECK: str
CHECK-NEXT: nop
CHECK-NEXT: ldr
And it would be bit more robust and immediately clear what the intended behaviour is.
https://github.com/llvm/llvm-project/pull/167783
More information about the llvm-commits
mailing list