forked from OSchip/llvm-project
[RDF] Allow unlinking ref nodes from data-flow chains only
llvm-svn: 258073
This commit is contained in:
parent
eb85b04c7e
commit
69e670d5f9
|
@ -183,9 +183,9 @@ bool DeadCodeElimination::erase(const SetVector<NodeId> &Nodes) {
|
|||
if (trace())
|
||||
dbgs() << " " << PrintNode<RefNode*>(RA, DFG) << '\n';
|
||||
if (DFG.IsUse(RA))
|
||||
DFG.unlinkUse(RA);
|
||||
DFG.unlinkUse(RA, true);
|
||||
else if (DFG.IsDef(RA))
|
||||
DFG.unlinkDef(RA);
|
||||
DFG.unlinkDef(RA, true);
|
||||
}
|
||||
|
||||
// Now, remove all dead instruction nodes.
|
||||
|
|
|
@ -1456,9 +1456,9 @@ void DataFlowGraph::removeUnusedPhis() {
|
|||
PhiQ.insert(OA.Id);
|
||||
}
|
||||
if (RA.Addr->isDef())
|
||||
unlinkDef(RA);
|
||||
unlinkDef(RA, true);
|
||||
else
|
||||
unlinkUse(RA);
|
||||
unlinkUse(RA, true);
|
||||
}
|
||||
NodeAddr<BlockNode*> BA = PA.Addr->getOwner(*this);
|
||||
BA.Addr->removeMember(PA, *this);
|
||||
|
@ -1593,13 +1593,10 @@ void DataFlowGraph::linkBlockRefs(DefStackMap &DefM, NodeAddr<BlockNode*> BA) {
|
|||
}
|
||||
|
||||
// Remove the use node UA from any data-flow and structural links.
|
||||
void DataFlowGraph::unlinkUse(NodeAddr<UseNode*> UA) {
|
||||
void DataFlowGraph::unlinkUseDF(NodeAddr<UseNode*> UA) {
|
||||
NodeId RD = UA.Addr->getReachingDef();
|
||||
NodeId Sib = UA.Addr->getSibling();
|
||||
|
||||
NodeAddr<InstrNode*> IA = UA.Addr->getOwner(*this);
|
||||
IA.Addr->removeMember(UA, *this);
|
||||
|
||||
if (RD == 0) {
|
||||
assert(Sib == 0);
|
||||
return;
|
||||
|
@ -1623,7 +1620,7 @@ void DataFlowGraph::unlinkUse(NodeAddr<UseNode*> UA) {
|
|||
}
|
||||
|
||||
// Remove the def node DA from any data-flow and structural links.
|
||||
void DataFlowGraph::unlinkDef(NodeAddr<DefNode*> DA) {
|
||||
void DataFlowGraph::unlinkDefDF(NodeAddr<DefNode*> DA) {
|
||||
//
|
||||
// RD
|
||||
// | reached
|
||||
|
@ -1710,7 +1707,4 @@ void DataFlowGraph::unlinkDef(NodeAddr<DefNode*> DA) {
|
|||
Last.Addr->setSibling(RDA.Addr->getReachedUse());
|
||||
RDA.Addr->setReachedUse(ReachedUses.front().Id);
|
||||
}
|
||||
|
||||
NodeAddr<InstrNode*> IA = DA.Addr->getOwner(*this);
|
||||
IA.Addr->removeMember(DA, *this);
|
||||
}
|
||||
|
|
|
@ -697,8 +697,16 @@ namespace rdf {
|
|||
NodeList getRelatedRefs(NodeAddr<InstrNode*> IA,
|
||||
NodeAddr<RefNode*> RA) const;
|
||||
|
||||
void unlinkUse(NodeAddr<UseNode*> UA);
|
||||
void unlinkDef(NodeAddr<DefNode*> DA);
|
||||
void unlinkUse(NodeAddr<UseNode*> UA, bool RemoveFromOwner) {
|
||||
unlinkUseDF(UA);
|
||||
if (RemoveFromOwner)
|
||||
removeFromOwner(UA);
|
||||
}
|
||||
void unlinkDef(NodeAddr<DefNode*> DA, bool RemoveFromOwner) {
|
||||
unlinkDefDF(DA);
|
||||
if (RemoveFromOwner)
|
||||
removeFromOwner(DA);
|
||||
}
|
||||
|
||||
// Some useful filters.
|
||||
template <uint16_t Kind>
|
||||
|
@ -765,6 +773,13 @@ namespace rdf {
|
|||
void linkStmtRefs(DefStackMap &DefM, NodeAddr<StmtNode*> SA);
|
||||
void linkBlockRefs(DefStackMap &DefM, NodeAddr<BlockNode*> BA);
|
||||
|
||||
void unlinkUseDF(NodeAddr<UseNode*> UA);
|
||||
void unlinkDefDF(NodeAddr<DefNode*> DA);
|
||||
void removeFromOwner(NodeAddr<RefNode*> RA) {
|
||||
NodeAddr<InstrNode*> IA = RA.Addr->getOwner(*this);
|
||||
IA.Addr->removeMember(RA, *this);
|
||||
}
|
||||
|
||||
TimerGroup TimeG;
|
||||
NodeAddr<FuncNode*> Func;
|
||||
NodeAllocator Memory;
|
||||
|
|
Loading…
Reference in New Issue