Skip to content

Commit

Permalink
[DominanceFrontier] Remove unused functions (#106913)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata authored Sep 3, 2024
1 parent 1fbb6b4 commit 451a313
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 122 deletions.
20 changes: 0 additions & 20 deletions llvm/include/llvm/Analysis/DominanceFrontier.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
78 changes: 0 additions & 78 deletions llvm/include/llvm/Analysis/DominanceFrontierImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
24 changes: 0 additions & 24 deletions llvm/include/llvm/CodeGen/MachineDominanceFrontier.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 451a313

Please sign in to comment.