diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-05-23 03:31:47 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-05-23 03:31:47 +0000 |
commit | 5110102f9f7e7ddcd74d3bce1e5de3f898ba5e7f (patch) | |
tree | f396847758df61a65082835c185f86e5b66086d7 | |
parent | 23e24bd284b585d906bec112aba1a5b5363cc4be (diff) | |
download | external_llvm-5110102f9f7e7ddcd74d3bce1e5de3f898ba5e7f.zip external_llvm-5110102f9f7e7ddcd74d3bce1e5de3f898ba5e7f.tar.gz external_llvm-5110102f9f7e7ddcd74d3bce1e5de3f898ba5e7f.tar.bz2 |
Fix a leak on the r600 backend.
This should bring the valgrind bot back to life.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182561 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/R600/AMDGPUTargetMachine.cpp | 8 | ||||
-rw-r--r-- | lib/Target/R600/AMDGPUTargetMachine.h | 12 |
2 files changed, 12 insertions, 8 deletions
diff --git a/lib/Target/R600/AMDGPUTargetMachine.cpp b/lib/Target/R600/AMDGPUTargetMachine.cpp index 71be02a..88dc583 100644 --- a/lib/Target/R600/AMDGPUTargetMachine.cpp +++ b/lib/Target/R600/AMDGPUTargetMachine.cpp @@ -64,11 +64,11 @@ AMDGPUTargetMachine::AMDGPUTargetMachine(const Target &T, StringRef TT, InstrItins(&Subtarget.getInstrItineraryData()) { // TLInfo uses InstrInfo so it must be initialized after. if (Subtarget.device()->getGeneration() <= AMDGPUDeviceInfo::HD6XXX) { - InstrInfo = new R600InstrInfo(*this); - TLInfo = new R600TargetLowering(*this); + InstrInfo.reset(new R600InstrInfo(*this)); + TLInfo.reset(new R600TargetLowering(*this)); } else { - InstrInfo = new SIInstrInfo(*this); - TLInfo = new SITargetLowering(*this); + InstrInfo.reset(new SIInstrInfo(*this)); + TLInfo.reset(new SITargetLowering(*this)); } initAsmInfo(); } diff --git a/lib/Target/R600/AMDGPUTargetMachine.h b/lib/Target/R600/AMDGPUTargetMachine.h index 0db6639..bb26ed9 100644 --- a/lib/Target/R600/AMDGPUTargetMachine.h +++ b/lib/Target/R600/AMDGPUTargetMachine.h @@ -33,8 +33,8 @@ class AMDGPUTargetMachine : public LLVMTargetMachine { const DataLayout Layout; AMDGPUFrameLowering FrameLowering; AMDGPUIntrinsicInfo IntrinsicInfo; - const AMDGPUInstrInfo *InstrInfo; - AMDGPUTargetLowering *TLInfo; + OwningPtr<AMDGPUInstrInfo> InstrInfo; + OwningPtr<AMDGPUTargetLowering> TLInfo; const InstrItineraryData *InstrItins; public: @@ -48,12 +48,16 @@ public: virtual const AMDGPUIntrinsicInfo *getIntrinsicInfo() const { return &IntrinsicInfo; } - virtual const AMDGPUInstrInfo *getInstrInfo() const { return InstrInfo; } + virtual const AMDGPUInstrInfo *getInstrInfo() const { + return InstrInfo.get(); + } virtual const AMDGPUSubtarget *getSubtargetImpl() const { return &Subtarget; } virtual const AMDGPURegisterInfo *getRegisterInfo() const { return &InstrInfo->getRegisterInfo(); } - virtual AMDGPUTargetLowering *getTargetLowering() const { return TLInfo; } + virtual AMDGPUTargetLowering *getTargetLowering() const { + return TLInfo.get(); + } virtual const InstrItineraryData *getInstrItineraryData() const { return InstrItins; } |