[llvm] r241951 - ARM: Use SpecificBumpPtrAllocator to fix leak introduced in r241920

Matthias Braun matze at braunis.de
Fri Jul 10 15:23:58 PDT 2015


Author: matze
Date: Fri Jul 10 17:23:57 2015
New Revision: 241951

URL: http://llvm.org/viewvc/llvm-project?rev=241951&view=rev
Log:
ARM: Use SpecificBumpPtrAllocator to fix leak introduced in r241920

Modified:
    llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp?rev=241951&r1=241950&r2=241951&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Fri Jul 10 17:23:57 2015
@@ -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(con
     }
 
     // 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::runOnMachineFuncti
       Modified |= MergeReturnIntoLDM(MBB);
   }
 
-  Allocator.Reset();
+  Allocator.DestroyAll();
   return Modified;
 }
 





More information about the llvm-commits mailing list