Switch AllocaDbgDeclares to SmallVector and don't leak DIFactory
authorVictor Hernandez <vhernandez@apple.com>
Tue, 26 Jan 2010 18:57:53 +0000 (18:57 +0000)
committerVictor Hernandez <vhernandez@apple.com>
Tue, 26 Jan 2010 18:57:53 +0000 (18:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94567 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/PromoteMemoryToRegister.cpp

index f6cb71a2233740a4299bd5d13c22800b375febe4..221abd63b8db887a7cbcad95221a97fc82f6bd38 100644 (file)
@@ -203,7 +203,7 @@ namespace {
     /// AllocaDbgDeclares - For each alloca, we keep track of the dbg.declare
     /// intrinsic that describes it, if any, so that we can convert it to a
     /// dbg.value intrinsic if the alloca gets promoted.
-    std::vector<DbgDeclareInst*> AllocaDbgDeclares;
+    SmallVector<DbgDeclareInst*, 8> AllocaDbgDeclares;
 
     /// Visited - The set of basic blocks the renamer has already visited.
     ///
@@ -219,6 +219,9 @@ namespace {
     PromoteMem2Reg(const std::vector<AllocaInst*> &A, DominatorTree &dt,
                    DominanceFrontier &df, AliasSetTracker *ast)
       : Allocas(A), DT(dt), DF(df), DIF(0), AST(ast) {}
+    ~PromoteMem2Reg() {
+      if (DIF) delete DIF;
+    }
 
     void run();