Skip to content

[DominanceFrontier] Remove unused functions #106913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot llvmbot added the llvm:analysis Includes value tracking, cost tables and constant folding label Sep 1, 2024
@llvmbot
Copy link
Member

llvmbot commented Sep 1, 2024

@llvm/pr-subscribers-llvm-analysis

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/106913.diff

3 Files Affected:

  • (modified) llvm/include/llvm/Analysis/DominanceFrontier.h (-20)
  • (modified) llvm/include/llvm/Analysis/DominanceFrontierImpl.h (-78)
  • (modified) llvm/include/llvm/CodeGen/MachineDominanceFrontier.h (-24)
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;

Copy link
Contributor

@fhahn fhahn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Copy link
Member

@kuhar kuhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kazutakahirata kazutakahirata merged commit 451a313 into llvm:main Sep 3, 2024
10 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_Dom branch September 3, 2024 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:analysis Includes value tracking, cost tables and constant folding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants