[llvm] Spill/restore FP/BP around instructions in which they are clobbered (PR #81048)

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 13 17:12:58 PST 2024


weiguozhi wrote:

Thanks for the test case. I added it to this patch.

This is exactly what I had in my mind, see the comments for function spillFrameBasePointer. But I failed to find a real test case. So I disabled checking fp by default. It can be enabled with -spill-clobbered-fp=true, and then I got

```
        pushq   %rbp
        movq    %rsp, %rbp
        pushq   %r15
        pushq   %r14
        pushq   %r13
        pushq   %r12
        pushq   %rbx
        andq    $-16, %rsp
        subq    $16, %rsp
        pushq   %rbp                   // save rbp
        pushq   %rax
        movl    %esi, %ebp
        movq    %rdi, %r13
        callq   external at PLT
        addq    $8, %rsp
        popq    %rbp                   // restore rbp
        leaq    -40(%rbp), %rsp
        popq    %rbx
        popq    %r12
        popq    %r13
        popq    %r14
        popq    %r15
        popq    %rbp
        retq
```

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


More information about the llvm-commits mailing list