[llvm] [AArch64] Fix pairing different types of registers when computing CSRs. (PR #66642)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 27 09:23:53 PDT 2023


kyulee-com wrote:

> This patch is not changing the behavior of unwind info generation.

Intuitively, this doesn't seem right as you also save and restore `xzr` at the bottom of stack.

If you compare your test before/after `-homogeneous-prolog-epilog`, it seems different codegen semantically.
For instance, it didn't save `x29` originally while it now saves `x29`. As mentioned above, the bottom of stack seems different. Originally it had `x28/x27` at `sp+16` while it is now with `x28/xzr` at `sp+0`. So, the subsequent instruction `str     x21, [sp, #8] ` in the function body seems overlapped with the latter.

I suggest adding a real test case to confirm the change. Also suggest adding more comments as the underlying assumption was changed quite a bit. In fact, I prefer to have a right implementation for easier maintenance/understanding although it might lead to more substantial changes.

Another note/tip on debugging. Although the original implementation does not have a flag to expand the helper in place, I think the transformation should be still semantically valid even if `shouldUseFrameHelper` were false always, although I don't expect the same code sequence as the original code.


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


More information about the llvm-commits mailing list