@@ -111,7 +111,7 @@ static bool isZAorZT0RegOp(const TargetRegisterInfo &TRI,
111111// / to where any code required to change the ZA state should be inserted.
112112static std::pair<ZAState, MachineBasicBlock::iterator>
113113getZAStateBeforeInst (const TargetRegisterInfo &TRI, MachineInstr &MI,
114- bool ZALiveAtReturn ) {
114+ bool ZAOffAtReturn ) {
115115 MachineBasicBlock::iterator InsertPt (MI);
116116
117117 if (MI.getOpcode () == AArch64::InOutZAUsePseudo)
@@ -121,7 +121,7 @@ getZAStateBeforeInst(const TargetRegisterInfo &TRI, MachineInstr &MI,
121121 return {ZAState::LOCAL_SAVED, std::prev (InsertPt)};
122122
123123 if (MI.isReturn ())
124- return {ZALiveAtReturn ? ZAState::ACTIVE : ZAState::OFF , InsertPt};
124+ return {ZAOffAtReturn ? ZAState::OFF : ZAState::ACTIVE , InsertPt};
125125
126126 for (auto &MO : MI.operands ()) {
127127 if (isZAorZT0RegOp (TRI, MO))
@@ -257,7 +257,7 @@ void MachineSMEABI::collectNeededZAStates(SMEAttrs SMEFnAttrs) {
257257 LiveUnits.stepBackward (MI);
258258 LiveRegs PhysLiveRegs = GetPhysLiveRegs ();
259259 auto [NeededState, InsertPt] = getZAStateBeforeInst (
260- *TRI, MI, /* ZALiveAtReturn =*/ SMEFnAttrs.hasSharedZAInterface ());
260+ *TRI, MI, /* ZAOffAtReturn =*/ SMEFnAttrs.hasPrivateZAInterface ());
261261 assert ((InsertPt == MBBI ||
262262 InsertPt->getOpcode () == AArch64::ADJCALLSTACKDOWN) &&
263263 " Unexpected state change insertion point!" );
@@ -287,7 +287,7 @@ void MachineSMEABI::assignBundleZAStates() {
287287 for (unsigned BlockID : Bundles->getBlocks (I)) {
288288 LLVM_DEBUG (dbgs () << " - bb." << BlockID);
289289
290- BlockInfo &Block = State.Blocks [BlockID];
290+ const BlockInfo &Block = State.Blocks [BlockID];
291291 if (Block.Insts .empty ()) {
292292 LLVM_DEBUG (dbgs () << " (no state preference)\n " );
293293 continue ;
@@ -332,7 +332,7 @@ void MachineSMEABI::assignBundleZAStates() {
332332
333333void MachineSMEABI::insertStateChanges () {
334334 for (MachineBasicBlock &MBB : *MF) {
335- BlockInfo &Block = State.Blocks [MBB.getNumber ()];
335+ const BlockInfo &Block = State.Blocks [MBB.getNumber ()];
336336 ZAState InState =
337337 State.BundleStates [Bundles->getBundle (MBB.getNumber (), /* Out=*/ false )];
338338
0 commit comments