[all-commits] [llvm/llvm-project] 308367: [X86] Don't use `rbp` when it's reserved (#146638)

Brandt Bucher via All-commits all-commits at lists.llvm.org
Mon Jul 7 02:03:08 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 30836781e8019dc34995f7bb0ef163c4c3660c54
      https://github.com/llvm/llvm-project/commit/30836781e8019dc34995f7bb0ef163c4c3660c54
  Author: Brandt Bucher <brandtbucher at microsoft.com>
  Date:   2025-07-07 (Mon, 07 Jul 2025)

  Changed paths:
    M llvm/lib/Target/X86/X86RegisterInfo.cpp
    A llvm/test/CodeGen/X86/frame-pointer-reserved.ll

  Log Message:
  -----------
  [X86] Don't use `rbp` when it's reserved (#146638)

This fixes the x86 backend to properly reserve `rbp` when the
`frame-pointer=reserved` option is used. Currently, this option is
ignored.

Disassembly of the new test case before:

```s
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %ebp
callq bar at PLT
movl %ebp, %edi
movl %ebx, %esi
callq bar at PLT
addq $8, %rsp
popq %rbx
popq %rbp
retq
```

...and after (`r14` is used as scratch space in place of `rbp`):

```s
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movl %edi, %r14d
callq bar at PLT
movl %r14d, %edi
movl %ebx, %esi
callq bar at PLT
addq $8, %rsp
popq %rbx
popq %r14
retq
```

Fixes #117178.



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