[llvm] [AArch64][SME] Rework VG CFI information for streaming-mode changes (PR #152283)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 6 07:56:50 PDT 2025


================
@@ -545,6 +548,16 @@ bool AArch64FrameLowering::hasFPImpl(const MachineFunction &MF) const {
       MFI.hasStackMap() || MFI.hasPatchPoint() ||
       RegInfo->hasStackRealignment(MF))
     return true;
+  // If we have streaming mode changes and SVE registers on the stack we need a
+  // FP. This is as the stack size may depend on the VG at entry to the
+  // function, which is saved before the SVE area (so unrecoverable without a
+  // FP). Similar for locally streaming functions, but it is because we use
+  // ADDSVL to setup the SVE stack (which might not match VG, even without
+  // streaming-mode changes).
+  if (AFI.needsDwarfUnwindInfo(MF) &&
+      ((requiresSaveVG(MF) || AFI.getSMEFnAttrs().hasStreamingBody()) &&
----------------
sdesmalen-arm wrote:

We discussed this offline; `AFI.getSMEFnAttrs().hasStreamingBody()` can be folded into `requiresSaveVG`, but that requires updating the code that sets up the stack using `addsvl` to check if the function actually has a streaming-mode change, and otherwise just use `addvl`. Then you don't have to check for `hasStreamingBody()` here.

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


More information about the llvm-commits mailing list