[llvm] r182561 - Fix a leak on the r600 backend.

Rafael Espindola rafael.espindola at gmail.com
Wed May 22 20:31:47 PDT 2013


Author: rafael
Date: Wed May 22 22:31:47 2013
New Revision: 182561

URL: http://llvm.org/viewvc/llvm-project?rev=182561&view=rev
Log:
Fix a leak on the r600 backend.

This should bring the valgrind bot back to life.

Modified:
    llvm/trunk/lib/Target/R600/AMDGPUTargetMachine.cpp
    llvm/trunk/lib/Target/R600/AMDGPUTargetMachine.h

Modified: llvm/trunk/lib/Target/R600/AMDGPUTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/AMDGPUTargetMachine.cpp?rev=182561&r1=182560&r2=182561&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/AMDGPUTargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/R600/AMDGPUTargetMachine.cpp Wed May 22 22:31:47 2013
@@ -64,11 +64,11 @@ AMDGPUTargetMachine::AMDGPUTargetMachine
   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();
 }

Modified: llvm/trunk/lib/Target/R600/AMDGPUTargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/AMDGPUTargetMachine.h?rev=182561&r1=182560&r2=182561&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/AMDGPUTargetMachine.h (original)
+++ llvm/trunk/lib/Target/R600/AMDGPUTargetMachine.h Wed May 22 22:31:47 2013
@@ -33,8 +33,8 @@ class AMDGPUTargetMachine : public LLVMT
   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;
   }





More information about the llvm-commits mailing list