[llvm] [DominanceFrontier] Remove unused functions (PR #106913)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 1 09:55:28 PDT 2024


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/106913

None

>From a8fed24574bd21160b4424b0ab1eac99df0b241a Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 1 Sep 2024 09:01:35 -0700
Subject: [PATCH] [DominanceFrontier] Remove unused functions

---
 .../include/llvm/Analysis/DominanceFrontier.h | 20 -----
 .../llvm/Analysis/DominanceFrontierImpl.h     | 78 -------------------
 .../llvm/CodeGen/MachineDominanceFrontier.h   | 24 ------
 3 files changed, 122 deletions(-)

diff --git a/llvm/include/llvm/Analysis/DominanceFrontier.h b/llvm/include/llvm/Analysis/DominanceFrontier.h
index 8b3ab57ed4d07b..68ddcf753b59f7 100644
--- a/llvm/include/llvm/Analysis/DominanceFrontier.h
+++ b/llvm/include/llvm/Analysis/DominanceFrontier.h
@@ -85,26 +85,6 @@ class DominanceFrontierBase {
   iterator find(BlockT *B) { return Frontiers.find(B); }
   const_iterator find(BlockT *B) const { return Frontiers.find(B); }
 
-  iterator addBasicBlock(BlockT *BB, const DomSetType &frontier) {
-    assert(find(BB) == end() && "Block already in DominanceFrontier!");
-    return Frontiers.insert(std::make_pair(BB, frontier)).first;
-  }
-
-  /// removeBlock - Remove basic block BB's frontier.
-  void removeBlock(BlockT *BB);
-
-  void addToFrontier(iterator I, BlockT *Node);
-
-  void removeFromFrontier(iterator I, BlockT *Node);
-
-  /// compareDomSet - Return false if two domsets match. Otherwise
-  /// return true;
-  bool compareDomSet(DomSetType &DS1, const DomSetType &DS2) const;
-
-  /// compare - Return false if the other dominance frontier base matches
-  /// this dominance frontier base. Otherwise return true.
-  bool compare(DominanceFrontierBase &Other) const;
-
   /// print - Convert to human readable form
   ///
   void print(raw_ostream &OS) const;
diff --git a/llvm/include/llvm/Analysis/DominanceFrontierImpl.h b/llvm/include/llvm/Analysis/DominanceFrontierImpl.h
index a9c415f4701094..e877b2c4749abe 100644
--- a/llvm/include/llvm/Analysis/DominanceFrontierImpl.h
+++ b/llvm/include/llvm/Analysis/DominanceFrontierImpl.h
@@ -45,84 +45,6 @@ class DFCalculateWorkObject {
   const DomTreeNodeT *parentNode;
 };
 
-template <class BlockT, bool IsPostDom>
-void DominanceFrontierBase<BlockT, IsPostDom>::removeBlock(BlockT *BB) {
-  assert(find(BB) != end() && "Block is not in DominanceFrontier!");
-  for (iterator I = begin(), E = end(); I != E; ++I)
-    I->second.remove(BB);
-  Frontiers.erase(BB);
-}
-
-template <class BlockT, bool IsPostDom>
-void DominanceFrontierBase<BlockT, IsPostDom>::addToFrontier(iterator I,
-                                                             BlockT *Node) {
-  assert(I != end() && "BB is not in DominanceFrontier!");
-  I->second.insert(Node);
-}
-
-template <class BlockT, bool IsPostDom>
-void DominanceFrontierBase<BlockT, IsPostDom>::removeFromFrontier(
-    iterator I, BlockT *Node) {
-  assert(I != end() && "BB is not in DominanceFrontier!");
-  assert(I->second.count(Node) && "Node is not in DominanceFrontier of BB");
-  I->second.remove(Node);
-}
-
-template <class BlockT, bool IsPostDom>
-bool DominanceFrontierBase<BlockT, IsPostDom>::compareDomSet(
-    DomSetType &DS1, const DomSetType &DS2) const {
-  std::set<BlockT *> tmpSet;
-  for (BlockT *BB : DS2)
-    tmpSet.insert(BB);
-
-  for (typename DomSetType::const_iterator I = DS1.begin(), E = DS1.end();
-       I != E;) {
-    BlockT *Node = *I++;
-
-    if (tmpSet.erase(Node) == 0)
-      // Node is in DS1 but tnot in DS2.
-      return true;
-  }
-
-  if (!tmpSet.empty()) {
-    // There are nodes that are in DS2 but not in DS1.
-    return true;
-  }
-
-  // DS1 and DS2 matches.
-  return false;
-}
-
-template <class BlockT, bool IsPostDom>
-bool DominanceFrontierBase<BlockT, IsPostDom>::compare(
-    DominanceFrontierBase<BlockT, IsPostDom> &Other) const {
-  DomSetMapType tmpFrontiers;
-  for (typename DomSetMapType::const_iterator I = Other.begin(),
-                                              E = Other.end();
-       I != E; ++I)
-    tmpFrontiers.insert(std::make_pair(I->first, I->second));
-
-  for (typename DomSetMapType::iterator I = tmpFrontiers.begin(),
-                                        E = tmpFrontiers.end();
-       I != E;) {
-    BlockT *Node = I->first;
-    const_iterator DFI = find(Node);
-    if (DFI == end())
-      return true;
-
-    if (compareDomSet(I->second, DFI->second))
-      return true;
-
-    ++I;
-    tmpFrontiers.erase(Node);
-  }
-
-  if (!tmpFrontiers.empty())
-    return true;
-
-  return false;
-}
-
 template <class BlockT, bool IsPostDom>
 void DominanceFrontierBase<BlockT, IsPostDom>::print(raw_ostream &OS) const {
   for (const_iterator I = begin(), E = end(); I != E; ++I) {
diff --git a/llvm/include/llvm/CodeGen/MachineDominanceFrontier.h b/llvm/include/llvm/CodeGen/MachineDominanceFrontier.h
index e3e679608784a4..7df060a3f5b1a9 100644
--- a/llvm/include/llvm/CodeGen/MachineDominanceFrontier.h
+++ b/llvm/include/llvm/CodeGen/MachineDominanceFrontier.h
@@ -73,30 +73,6 @@ class MachineDominanceFrontier : public MachineFunctionPass {
     return Base.find(B);
   }
 
-  iterator addBasicBlock(MachineBasicBlock *BB, const DomSetType &frontier) {
-    return Base.addBasicBlock(BB, frontier);
-  }
-
-  void removeBlock(MachineBasicBlock *BB) {
-    return Base.removeBlock(BB);
-  }
-
-  void addToFrontier(iterator I, MachineBasicBlock *Node) {
-    return Base.addToFrontier(I, Node);
-  }
-
-  void removeFromFrontier(iterator I, MachineBasicBlock *Node) {
-    return Base.removeFromFrontier(I, Node);
-  }
-
-  bool compareDomSet(DomSetType &DS1, const DomSetType &DS2) const {
-    return Base.compareDomSet(DS1, DS2);
-  }
-
-  bool compare(DominanceFrontierBase<MachineBasicBlock, false> &Other) const {
-    return Base.compare(Other);
-  }
-
   bool runOnMachineFunction(MachineFunction &F) override;
 
   void releaseMemory() override;



More information about the llvm-commits mailing list