[PATCH] D126861: [RISCV] Fix missing stack pointer recover
Kito Cheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 6 08:13:55 PDT 2022
kito-cheng added a comment.
> Kito, I don't get your comment. I'd expect the CSR restores to be happening before stack adjustment.
It's too late to do stack adjustment after CSR restore by moving `fp` to `sp`, because `s0`(`fp`) is CSR.
addi sp, s0, -32
ld ra, 24(sp) # 8-byte Folded Reload
ld s0, 16(sp) # 8-byte Folded Reload <----- s0 is restore here
ld s1, 8(sp) # 8-byte Folded Reload
addi sp, sp, 32
ret
> Are you saying that there's some other code which tries to insert restores in the middle of the existing stack adjustment sequence?
No, I mean signal and interrupt might raise during epilogue, and that will keep using `sp`, and adjust that in the handler, so `sp` must adjust after CSR restores.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126861/new/
https://reviews.llvm.org/D126861
More information about the llvm-commits
mailing list