diff --git a/llvm/lib/Target/SystemZ/SystemZSubtarget.h b/llvm/lib/Target/SystemZ/SystemZSubtarget.h --- a/llvm/lib/Target/SystemZ/SystemZSubtarget.h +++ b/llvm/lib/Target/SystemZ/SystemZSubtarget.h @@ -77,7 +77,7 @@ private: Triple TargetTriple; - SystemZCallingConventionRegisters *SpecialRegisters; + std::unique_ptr SpecialRegisters; SystemZInstrInfo InstrInfo; SystemZTargetLowering TLInfo; SystemZSelectionDAGInfo TSInfo; @@ -91,11 +91,9 @@ SystemZSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM); - ~SystemZSubtarget(); - SystemZCallingConventionRegisters *getSpecialRegisters() const { assert(SpecialRegisters && "Unsupported SystemZ calling convention"); - return SpecialRegisters; + return SpecialRegisters.get(); } const TargetFrameLowering *getFrameLowering() const override { diff --git a/llvm/lib/Target/SystemZ/SystemZSubtarget.cpp b/llvm/lib/Target/SystemZ/SystemZSubtarget.cpp --- a/llvm/lib/Target/SystemZ/SystemZSubtarget.cpp +++ b/llvm/lib/Target/SystemZ/SystemZSubtarget.cpp @@ -91,8 +91,6 @@ InstrInfo(initializeSubtargetDependencies(CPU, FS)), TLInfo(TM, *this), TSInfo(), FrameLowering() {} -SystemZSubtarget::~SystemZSubtarget() { delete getSpecialRegisters(); } - bool SystemZSubtarget::enableSubRegLiveness() const { return UseSubRegLiveness; }