[llvm] r254808 - CodeGen: Let the BumpPtrAllocator free the elements of indexList

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 4 16:39:15 PST 2015


Author: bogner
Date: Fri Dec  4 18:39:14 2015
New Revision: 254808

URL: http://llvm.org/viewvc/llvm-project?rev=254808&view=rev
Log:
CodeGen: Let the BumpPtrAllocator free the elements of indexList

The indexList's nodes are all allocated on a BumpPtrAllocator, so it's
more efficient to let them be freed when it goes away, rather than
deleting them directly. This is a follow up to r254794.

Modified:
    llvm/trunk/include/llvm/CodeGen/SlotIndexes.h

Modified: llvm/trunk/include/llvm/CodeGen/SlotIndexes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SlotIndexes.h?rev=254808&r1=254807&r2=254808&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SlotIndexes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SlotIndexes.h Fri Dec  4 18:39:14 2015
@@ -376,6 +376,11 @@ namespace llvm {
       initializeSlotIndexesPass(*PassRegistry::getPassRegistry());
     }
 
+    ~SlotIndexes() {
+      // The indexList's nodes are all allocated in the BumpPtrAllocator.
+      indexList.clearAndLeakNodesUnsafely();
+    }
+
     void getAnalysisUsage(AnalysisUsage &au) const override;
     void releaseMemory() override;
 




More information about the llvm-commits mailing list