Implement releaseMemory in CodeGenPrepare and free the BackEdges
authorDan Gohman <gohman@apple.com>
Fri, 5 Feb 2010 19:24:11 +0000 (19:24 +0000)
committerDan Gohman <gohman@apple.com>
Fri, 5 Feb 2010 19:24:11 +0000 (19:24 +0000)
container data. This prevents it from holding onto dangling
pointers and potentially behaving unpredictably.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95409 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/CodeGenPrepare.cpp

index c3139a511bb58f9e032929ca8958020ee1064e7e..fa60d3f29060bdf1dd03c6dac851bebc1eaa9f78 100644 (file)
@@ -63,6 +63,10 @@ namespace {
       AU.addPreserved<ProfileInfo>();
     }
 
+    virtual void releaseMemory() {
+      BackEdges.clear();
+    }
+
   private:
     bool EliminateMostlyEmptyBlocks(Function &F);
     bool CanMergeBlocks(const BasicBlock *BB, const BasicBlock *DestBB) const;