ARM: Use SpecificBumpPtrAllocator to fix leak introduced in r241920

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241951 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Matthias Braun 2015-07-10 22:23:57 +00:00
parent 09450da653
commit eada3a8b97

View File

@ -116,7 +116,7 @@ namespace {
/// Whether the instructions can be merged into a ldrd/strd instruction.
bool CanMergeToLSDouble;
};
BumpPtrAllocator Allocator;
SpecificBumpPtrAllocator<MergeCandidate> Allocator;
SmallVector<const MergeCandidate*,4> Candidates;
SmallVector<MachineInstr*,4> MergeBaseCandidates;
@ -996,7 +996,7 @@ void ARMLoadStoreOpt::FormCandidates(const MemOpQueue &MemOps) {
}
// Form a candidate from the Ops collected so far.
MergeCandidate *Candidate = new(Allocator) MergeCandidate;
MergeCandidate *Candidate = new(Allocator.Allocate()) MergeCandidate;
for (unsigned C = SIndex, CE = SIndex + Count; C < CE; ++C)
Candidate->Instrs.push_back(MemOps[C].MI);
Candidate->LatestMIIdx = Latest - SIndex;
@ -1849,7 +1849,7 @@ bool ARMLoadStoreOpt::runOnMachineFunction(MachineFunction &Fn) {
Modified |= MergeReturnIntoLDM(MBB);
}
Allocator.Reset();
Allocator.DestroyAll();
return Modified;
}