DomTree: Remove the releaseMemory() method
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 18 May 2020 14:28:26 +0000 (16:28 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 6 Jul 2020 19:58:11 +0000 (21:58 +0200)
Summary:
It is fully redundant with reset().

Change-Id: I25850b9f08eace757cf03cbb8780e970aca7f51a

Reviewers: arsenm, RKSimon, mehdi_amini, courbet

Subscribers: wdng, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D83084

clang/include/clang/Analysis/Analyses/Dominators.h
llvm/include/llvm/Analysis/PostDominators.h
llvm/include/llvm/IR/Dominators.h
llvm/include/llvm/Support/GenericDomTree.h

index 061c981..51d86f6 100644 (file)
@@ -167,9 +167,7 @@ public:
   }
 
   /// Releases the memory held by the dominator tree.
-  virtual void releaseMemory() {
-    DT.releaseMemory();
-  }
+  virtual void releaseMemory() { DT.reset(); }
 
   /// Converts the dominator tree to human readable form.
   virtual void print(raw_ostream &OS, const llvm::Module* M= nullptr) const {
index 801eb3d..296110d 100644 (file)
@@ -88,9 +88,7 @@ struct PostDominatorTreeWrapperPass : public FunctionPass {
     AU.setPreservesAll();
   }
 
-  void releaseMemory() override {
-    DT.releaseMemory();
-  }
+  void releaseMemory() override { DT.reset(); }
 
   void print(raw_ostream &OS, const Module*) const override;
 };
index a79be87..0084ac0 100644 (file)
@@ -277,7 +277,7 @@ public:
     AU.setPreservesAll();
   }
 
-  void releaseMemory() override { DT.releaseMemory(); }
+  void releaseMemory() override { DT.reset(); }
 
   void print(raw_ostream &OS, const Module *M = nullptr) const override;
 };
index d932938..e83e7aa 100644 (file)
@@ -325,8 +325,6 @@ protected:
     return false;
   }
 
-  void releaseMemory() { reset(); }
-
   /// getNode - return the (Post)DominatorTree node for the specified basic
   /// block.  This is the same as using operator[] on this class.  The result
   /// may (but is not required to) be null for a forward (backwards)
@@ -760,9 +758,6 @@ public:
     return DomTreeBuilder::Verify(*this, VL);
   }
 
-protected:
-  void addRoot(NodeT *BB) { this->Roots.push_back(BB); }
-
   void reset() {
     DomTreeNodes.clear();
     Roots.clear();
@@ -772,6 +767,9 @@ protected:
     SlowQueries = 0;
   }
 
+protected:
+  void addRoot(NodeT *BB) { this->Roots.push_back(BB); }
+
   // NewBB is split and now it has one successor. Update dominator tree to
   // reflect this change.
   template <class N>