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
This commit is contained in:
Rafael Espindola 2013-05-23 03:31:47 +00:00
parent 23e24bd284
commit 5110102f9f
2 changed files with 12 additions and 8 deletions

View File

@ -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();
}

View File

@ -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;
}