[all-commits] [llvm/llvm-project] 26f97e: [AArch64] Stop reserved registers from being saved...
Nuko Y. via All-commits
all-commits at lists.llvm.org
Mon May 12 15:10:49 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 26f97ee9aa413db240c397f96ddd5b0553a57d30
https://github.com/llvm/llvm-project/commit/26f97ee9aa413db240c397f96ddd5b0553a57d30
Author: Nuko Y. <or at dmc.chat>
Date: 2025-05-12 (Mon, 12 May 2025)
Changed paths:
M llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
M llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp
M llvm/lib/Target/AArch64/AArch64RegisterInfo.h
A llvm/test/CodeGen/AArch64/reserveXreg-for-regalloc.ll
M llvm/test/CodeGen/AArch64/reserveXreg.ll
Log Message:
-----------
[AArch64] Stop reserved registers from being saved in prolog/epilog (#138448)
[GCC's
documentation](https://gcc.gnu.org/onlinedocs/gcc-15.1.0/gcc/Code-Gen-Options.html)
is clear on how -ffixed-reg must behave:
```
Treat the register named reg as a fixed register; generated
code should never refer to it (except perhaps as a stack pointer,
frame pointer or in some other fixed role).
```
This implies prolog/epilog code also must not save/restore explicitly
fixed registers, even when it is callee-saved. Some projects rely on
this (GCC's) behavior.
For example,
```
void f() {
register uint64_t x28 asm("x28") = 0xee;
asm volatile("" : "+r"(x28)); // avoid mov being eliminated
}
```
should not touch x28 outside of `mov w28,#0xee`.
For riscv64, clang behaves the same as GCC, so I am inclined to believe
this is indeed a bug.
Fixes #111379.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list