[llvm] r254803 - [PassManager] Ensure destructors of cached AnalysisUsage objects are run
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 4 15:48:19 PST 2015
Author: reames
Date: Fri Dec 4 17:48:19 2015
New Revision: 254803
URL: http://llvm.org/viewvc/llvm-project?rev=254803&view=rev
Log:
[PassManager] Ensure destructors of cached AnalysisUsage objects are run
In 254760, I introduced the usage of a BumpPtrAllocator for the AnalysisUsage instances held by the PassManger. This turns out to have been incorrect since a BumpPtrAllocator does not run the destructors of objects when deallocating memory. Since a few of our SmallVector's had grown beyond their small size, we end up with some leaked memory. We need to use a SpecificBumpPtrAllocator instead.
Modified:
llvm/trunk/include/llvm/IR/LegacyPassManagers.h
llvm/trunk/lib/IR/LegacyPassManager.cpp
Modified: llvm/trunk/include/llvm/IR/LegacyPassManagers.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/LegacyPassManagers.h?rev=254803&r1=254802&r2=254803&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/LegacyPassManagers.h (original)
+++ llvm/trunk/include/llvm/IR/LegacyPassManagers.h Fri Dec 4 17:48:19 2015
@@ -283,7 +283,7 @@ private:
// Allocator used for allocating UAFoldingSetNodes. This handles deletion of
// all allocated nodes in one fell swoop.
- BumpPtrAllocator AUFoldingSetNodeAllocator;
+ SpecificBumpPtrAllocator<AUFoldingSetNode> AUFoldingSetNodeAllocator;
// Maps from a pass to it's associated entry in UniqueAnalysisUsages. Does
// not own the storage associated with either key or value..
Modified: llvm/trunk/lib/IR/LegacyPassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LegacyPassManager.cpp?rev=254803&r1=254802&r2=254803&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LegacyPassManager.cpp (original)
+++ llvm/trunk/lib/IR/LegacyPassManager.cpp Fri Dec 4 17:48:19 2015
@@ -589,7 +589,7 @@ AnalysisUsage *PMTopLevelManager::findAn
if (auto *N = UniqueAnalysisUsages.FindNodeOrInsertPos(ID, IP))
Node = N;
else {
- Node = new (AUFoldingSetNodeAllocator) AUFoldingSetNode(AU);
+ Node = new (AUFoldingSetNodeAllocator.Allocate()) AUFoldingSetNode(AU);
UniqueAnalysisUsages.InsertNode(Node, IP);
}
assert(Node && "cached analysis usage must be non null");
More information about the llvm-commits
mailing list