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

2024-06-13 Thread Kerry McLaughlin via cfe-commits
https://github.com/kmclaughlin-arm closed https://github.com/llvm/llvm-project/pull/83301 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-06-13 Thread Kerry McLaughlin via cfe-commits
@@ -214,7 +232,8 @@ declare double @za_shared_callee(double) "aarch64_inout_za" define double @za_new_caller_to_za_shared_callee(double %x) nounwind noinline optnone "aarch64_new_za"{ ; CHECK-COMMON-LABEL: za_new_caller_to_za_shared_callee: ; CHECK-COMMON: // %bb.0: //

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

2024-06-13 Thread Sander de Smalen via cfe-commits
@@ -2995,7 +3062,9 @@ bool AArch64FrameLowering::spillCalleeSavedRegisters( ArrayRef CSI, const TargetRegisterInfo *TRI) const { MachineFunction = *MBB.getParent(); const TargetInstrInfo = *MF.getSubtarget().getInstrInfo(); + AArch64FunctionInfo *AFI = MF.getInfo();

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

2024-06-13 Thread Sander de Smalen via cfe-commits
https://github.com/sdesmalen-arm edited https://github.com/llvm/llvm-project/pull/83301 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-06-13 Thread Sander de Smalen via cfe-commits
@@ -3062,7 +3131,68 @@ bool AArch64FrameLowering::spillCalleeSavedRegisters( Size = 2; Alignment = Align(2); break; +case RegPairInfo::VG: + StrOpc = AArch64::STRXui; + Size = 8; + Alignment = Align(8); + break; +} + +

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

2024-06-13 Thread Sander de Smalen via cfe-commits
@@ -3062,7 +3131,68 @@ bool AArch64FrameLowering::spillCalleeSavedRegisters( Size = 2; Alignment = Align(2); break; +case RegPairInfo::VG: + StrOpc = AArch64::STRXui; + Size = 8; + Alignment = Align(8); + break; +} + +

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

2024-06-13 Thread Sander de Smalen via cfe-commits
https://github.com/sdesmalen-arm approved this pull request. Some very minor nits, but overall LGTM. https://github.com/llvm/llvm-project/pull/83301 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2024-06-11 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/83301 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-06-11 Thread Kerry McLaughlin via cfe-commits
@@ -196,12 +196,14 @@ bool AArch64FunctionInfo::needsAsyncDwarfUnwindInfo( const MachineFunction ) const { if (!NeedsAsyncDwarfUnwindInfo) { const Function = MF.getFunction(); +const AArch64FunctionInfo *AFI = MF.getInfo(); // The check got "minsize" is

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

2024-06-10 Thread Eli Friedman via cfe-commits
@@ -196,12 +196,14 @@ bool AArch64FunctionInfo::needsAsyncDwarfUnwindInfo( const MachineFunction ) const { if (!NeedsAsyncDwarfUnwindInfo) { const Function = MF.getFunction(); +const AArch64FunctionInfo *AFI = MF.getInfo(); // The check got "minsize" is

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

2024-06-10 Thread Eli Friedman via cfe-commits
@@ -214,7 +232,8 @@ declare double @za_shared_callee(double) "aarch64_inout_za" define double @za_new_caller_to_za_shared_callee(double %x) nounwind noinline optnone "aarch64_new_za"{ ; CHECK-COMMON-LABEL: za_new_caller_to_za_shared_callee: ; CHECK-COMMON: // %bb.0: //

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

2024-06-10 Thread Kerry McLaughlin via cfe-commits
@@ -214,7 +232,8 @@ declare double @za_shared_callee(double) "aarch64_inout_za" define double @za_new_caller_to_za_shared_callee(double %x) nounwind noinline optnone "aarch64_new_za"{ ; CHECK-COMMON-LABEL: za_new_caller_to_za_shared_callee: ; CHECK-COMMON: // %bb.0: //

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

2024-06-10 Thread Kerry McLaughlin via cfe-commits
@@ -196,12 +196,14 @@ bool AArch64FunctionInfo::needsAsyncDwarfUnwindInfo( const MachineFunction ) const { if (!NeedsAsyncDwarfUnwindInfo) { const Function = MF.getFunction(); +const AArch64FunctionInfo *AFI = MF.getInfo(); // The check got "minsize" is

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

2024-06-07 Thread Eli Friedman via cfe-commits
@@ -196,12 +196,14 @@ bool AArch64FunctionInfo::needsAsyncDwarfUnwindInfo( const MachineFunction ) const { if (!NeedsAsyncDwarfUnwindInfo) { const Function = MF.getFunction(); +const AArch64FunctionInfo *AFI = MF.getInfo(); // The check got "minsize" is

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

2024-06-07 Thread Eli Friedman via cfe-commits
@@ -214,7 +232,8 @@ declare double @za_shared_callee(double) "aarch64_inout_za" define double @za_new_caller_to_za_shared_callee(double %x) nounwind noinline optnone "aarch64_new_za"{ ; CHECK-COMMON-LABEL: za_new_caller_to_za_shared_callee: ; CHECK-COMMON: // %bb.0: //

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

2024-06-07 Thread Eli Friedman via cfe-commits
@@ -196,12 +196,14 @@ bool AArch64FunctionInfo::needsAsyncDwarfUnwindInfo( const MachineFunction ) const { if (!NeedsAsyncDwarfUnwindInfo) { const Function = MF.getFunction(); +const AArch64FunctionInfo *AFI = MF.getInfo(); // The check got "minsize" is

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

2024-06-07 Thread Kerry McLaughlin via cfe-commits
@@ -8287,6 +8289,13 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo , SDValue InGlue; if (RequiresSMChange) { + +if (Subtarget->hasSVE()) { kmclaughlin-arm wrote: I've made changes to `needsAsyncDwarfUnwindInfo` in

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

2024-06-05 Thread Eli Friedman via cfe-commits
@@ -8287,6 +8289,13 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo , SDValue InGlue; if (RequiresSMChange) { + +if (Subtarget->hasSVE()) { efriedma-quic wrote: Oh, right, there's also that dimension. I'm not sure I understand the interaction

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

2024-06-05 Thread Sander de Smalen via cfe-commits
@@ -8287,6 +8289,13 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo , SDValue InGlue; if (RequiresSMChange) { + +if (Subtarget->hasSVE()) { sdesmalen-arm wrote: @efriedma-quic I think the issue is that when we emit unwind info that is _not_

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

2024-06-04 Thread Eli Friedman via cfe-commits
@@ -8287,6 +8289,13 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo , SDValue InGlue; if (RequiresSMChange) { + +if (Subtarget->hasSVE()) { efriedma-quic wrote: If there's no DWARF unwind, nothing can unwind the stack whether or not we store

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

2024-06-04 Thread Kerry McLaughlin via cfe-commits
@@ -8287,6 +8289,13 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo , SDValue InGlue; if (RequiresSMChange) { + +if (Subtarget->hasSVE()) { kmclaughlin-arm wrote: If we still emit the spill of VG with `-fno-asynchronous-unwind-tables`, I don't

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

2024-06-03 Thread Eli Friedman via cfe-commits
@@ -8287,6 +8289,13 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo , SDValue InGlue; if (RequiresSMChange) { + +if (Subtarget->hasSVE()) { efriedma-quic wrote: There are two different kinds of DWARF "unwind info"; one is the kind that's in a

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

2024-06-03 Thread Kerry McLaughlin via cfe-commits
@@ -8287,6 +8289,13 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo , SDValue InGlue; if (RequiresSMChange) { + +if (Subtarget->hasSVE()) { kmclaughlin-arm wrote: > when I compile some code with -fno-asynchronous-unwind-tables, it will still >

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

2024-06-03 Thread Kerry McLaughlin via cfe-commits
@@ -3768,6 +3768,12 @@ def err_conflicting_attributes_arm_state : Error< "conflicting attributes for state '%0'">; def err_sme_streaming_cannot_be_multiversioned : Error< "streaming function cannot be multi-versioned">; +def err_sme_streaming_mode_change_no_sve : Error< +

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

2024-06-03 Thread Kerry McLaughlin via cfe-commits
@@ -1552,6 +1553,57 @@ bool AArch64ExpandPseudo::expandMI(MachineBasicBlock , case AArch64::COALESCER_BARRIER_FPR128: MI.eraseFromParent(); return true; + case AArch64::VGSavePseudo: + case AArch64::VGRestorePseudo: { + MachineFunction =

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

2024-06-03 Thread Kerry McLaughlin via cfe-commits
@@ -1552,6 +1553,57 @@ bool AArch64ExpandPseudo::expandMI(MachineBasicBlock , case AArch64::COALESCER_BARRIER_FPR128: MI.eraseFromParent(); return true; + case AArch64::VGSavePseudo: + case AArch64::VGRestorePseudo: { + MachineFunction =

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

2024-05-15 Thread Eli Friedman via cfe-commits
@@ -8287,6 +8289,13 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo , SDValue InGlue; if (RequiresSMChange) { + +if (Subtarget->hasSVE()) { efriedma-quic wrote: I'm not sure I follow what the issue is... I think we discussed before that we want

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

2024-05-15 Thread Eli Friedman via cfe-commits
@@ -3768,6 +3768,12 @@ def err_conflicting_attributes_arm_state : Error< "conflicting attributes for state '%0'">; def err_sme_streaming_cannot_be_multiversioned : Error< "streaming function cannot be multi-versioned">; +def err_sme_streaming_mode_change_no_sve : Error< +

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

2024-05-15 Thread Sander de Smalen via cfe-commits
@@ -1552,6 +1553,57 @@ bool AArch64ExpandPseudo::expandMI(MachineBasicBlock , case AArch64::COALESCER_BARRIER_FPR128: MI.eraseFromParent(); return true; + case AArch64::VGSavePseudo: + case AArch64::VGRestorePseudo: { + MachineFunction =

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

2024-05-15 Thread Sander de Smalen via cfe-commits
@@ -223,6 +228,12 @@ class AArch64FunctionInfo final : public MachineFunctionInfo { Register getPStateSMReg() const { return PStateSMReg; }; void setPStateSMReg(Register Reg) { PStateSMReg = Reg; }; + int64_t getVGIdx() const { return VGIdx; }; + void setVGIdx(unsigned

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

2024-05-15 Thread Sander de Smalen via cfe-commits
@@ -8443,9 +8452,16 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo , if (RequiresSMChange) { assert(PStateSM && "Expected a PStateSM to be set"); + sdesmalen-arm wrote: nit: unnecessary newline. https://github.com/llvm/llvm-project/pull/83301

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

2024-05-15 Thread Sander de Smalen via cfe-commits
@@ -1552,6 +1553,57 @@ bool AArch64ExpandPseudo::expandMI(MachineBasicBlock , case AArch64::COALESCER_BARRIER_FPR128: MI.eraseFromParent(); return true; + case AArch64::VGSavePseudo: + case AArch64::VGRestorePseudo: { + MachineFunction =

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

2024-05-15 Thread Sander de Smalen via cfe-commits
@@ -1552,6 +1553,57 @@ bool AArch64ExpandPseudo::expandMI(MachineBasicBlock , case AArch64::COALESCER_BARRIER_FPR128: MI.eraseFromParent(); return true; + case AArch64::VGSavePseudo: + case AArch64::VGRestorePseudo: { + MachineFunction =

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

2024-05-15 Thread Sander de Smalen via cfe-commits
@@ -8287,6 +8289,13 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo , SDValue InGlue; if (RequiresSMChange) { + +if (Subtarget->hasSVE()) { sdesmalen-arm wrote: I think we can only emit this pseudo when we have asynchronous unwind tables

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

2024-05-15 Thread Sander de Smalen via cfe-commits
@@ -1552,6 +1553,57 @@ bool AArch64ExpandPseudo::expandMI(MachineBasicBlock , case AArch64::COALESCER_BARRIER_FPR128: MI.eraseFromParent(); return true; + case AArch64::VGSavePseudo: + case AArch64::VGRestorePseudo: { + MachineFunction =

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

2024-05-15 Thread Sander de Smalen via cfe-commits
@@ -1552,6 +1553,57 @@ bool AArch64ExpandPseudo::expandMI(MachineBasicBlock , case AArch64::COALESCER_BARRIER_FPR128: MI.eraseFromParent(); return true; + case AArch64::VGSavePseudo: + case AArch64::VGRestorePseudo: { + MachineFunction =

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

2024-05-15 Thread Sander de Smalen via cfe-commits
@@ -3768,6 +3768,12 @@ def err_conflicting_attributes_arm_state : Error< "conflicting attributes for state '%0'">; def err_sme_streaming_cannot_be_multiversioned : Error< "streaming function cannot be multi-versioned">; +def err_sme_streaming_mode_change_no_sve : Error< +

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

2024-05-09 Thread Eli Friedman via cfe-commits
https://github.com/efriedma-quic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/83301 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-05-09 Thread Kerry McLaughlin via cfe-commits
@@ -221,6 +224,15 @@ def : Pat<(AArch64_smstop (i32 svcr_op:$pstate), (i64 /*AArch64SME::Always*/0)), (MSRpstatesvcrImm1 svcr_op:$pstate, 0b0)>; +// Pseudo to insert cfi_offset/cfi_restore instructions. Used to save or restore +// the streaming value of VG around

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

2024-05-09 Thread Kerry McLaughlin via cfe-commits
@@ -3730,6 +3730,12 @@ def warn_gnu_inline_cplusplus_without_extern : Warning< "'gnu_inline' attribute without 'extern' in C++ treated as externally" " available, this changed in Clang 10">, InGroup>; +def warn_sme_streaming_mode_change_no_sve : Warning< + "function

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

2024-05-05 Thread Eli Friedman via cfe-commits
@@ -221,6 +224,15 @@ def : Pat<(AArch64_smstop (i32 svcr_op:$pstate), (i64 /*AArch64SME::Always*/0)), (MSRpstatesvcrImm1 svcr_op:$pstate, 0b0)>; +// Pseudo to insert cfi_offset/cfi_restore instructions. Used to save or restore +// the streaming value of VG around

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

2024-05-05 Thread Eli Friedman via cfe-commits
@@ -3730,6 +3730,12 @@ def warn_gnu_inline_cplusplus_without_extern : Warning< "'gnu_inline' attribute without 'extern' in C++ treated as externally" " available, this changed in Clang 10">, InGroup>; +def warn_sme_streaming_mode_change_no_sve : Warning< + "function

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

2024-04-30 Thread Kerry McLaughlin via cfe-commits
kmclaughlin-arm wrote: Gentle ping :) https://github.com/llvm/llvm-project/pull/83301 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-04-22 Thread Kerry McLaughlin via cfe-commits
@@ -8001,6 +8007,22 @@ void Sema::checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto, } } +// SME functions may require SVE to be available for unwinding, as the +// value of VG needs to be preserved across streaming-mode changes. +if (CallerFD

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

2024-04-19 Thread Eli Friedman via cfe-commits
@@ -8001,6 +8007,22 @@ void Sema::checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto, } } +// SME functions may require SVE to be available for unwinding, as the +// value of VG needs to be preserved across streaming-mode changes. +if (CallerFD