[llvm] [AArch64][SME] Save VG for unwind info when changing streaming-mode (PR #83301)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 27 11:25:14 PDT 2024


efriedma-quic wrote:

> > On a related note, I'm not sure what we're generating here is really what we want for aarch64_pstate_sm_body. A aarch64_pstate_sm_body has two vector lengths: the length used for spilling the callee-saves, and the length used for local variables. If we only store the former, debuggers can't display local variables.
> 
> Thank you for raising this @efriedma-quic , it's something that was not handled correctly in my original patch. After some offline discussion about this scenario, I have made changes to the patch to ensure the correct value of VG can be recovered from locally-streaming functions. As I understand it, we need to store both the streaming and non-streaming vector length in the prologue and additionally save the streaming length before calls which require streaming-mode changes. After such calls, I believe we need to use `.cfi_restore` to set the rule for VG to the same as it was at the beginning of the function (which will be the non-streaming length).
> 
> This is based on my understanding of the specification as it is today, but I am happy to try a different implementation if this changes.

The sequences here seem fine.

> > Not sure this is actually the right choice, given the interaction with debug info. Presumably we want debuggers to be able to produce a stack trace for nounwind code.
> 
> Do you know if there is something else I could be checking to decide whether to emit VG for the nounwind case, or if it's better to remove the calls to `F.needsUnwindTableEntry()` that I added in the last commit altogether?

I think just remove the needsUnwindTableEntry() checks; it's more important to have consistent debug vs. non-debug codegen, vs. saving a couple instructions in the prologue.

------

On additional concern I just realized looking at the patch again: I don't think we can use cntd in non-streaming mode on targets without SVE.  (See #86743 for more discussion of SME without SVE.)

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


More information about the llvm-commits mailing list