[llvm] [AArch64][SME] Remove unused ZA lazy-save (PR #81648)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 05:41:04 PDT 2024


================
@@ -226,8 +231,8 @@ class AArch64FunctionInfo final : public MachineFunctionInfo {
   bool isSVECC() const { return IsSVECC; };
   void setIsSVECC(bool s) { IsSVECC = s; };
 
-  unsigned getLazySaveTPIDR2Obj() const { return LazySaveTPIDR2Obj; }
-  void setLazySaveTPIDR2Obj(unsigned Reg) { LazySaveTPIDR2Obj = Reg; }
+  std::optional<TPIDR2Object> getTPIDR2Obj() { return TPIDR2; }
----------------
sdesmalen-arm wrote:

What about returning a `TPIDRObject &` instead and removing the `std::optional` bit.

If the object's `Uses` field is 0, then we know it's not yet initialised. That would simplify the code in ISelLowering from:
```
  TPIDR2Object TPIDR2 = *FuncInfo->getTPIDR2Obj();
  ...
  TPIDR2.Uses++;
  FuncInfo->setTPIDR2Obj(TPIDR2);
```

into:

```
  TPIDR2Object &TPIDR2 = FuncInfo->getTPIDR2Obj();
  ...
  TPIDR2.Uses++;
```

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


More information about the llvm-commits mailing list