Index: llvm/trunk/include/llvm/IR/CFGDiff.h =================================================================== --- llvm/trunk/include/llvm/IR/CFGDiff.h +++ llvm/trunk/include/llvm/IR/CFGDiff.h @@ -78,7 +78,7 @@ // newly inserted. The current diff treats the CFG as a graph rather than a // multigraph. Added edges are pruned to be unique, and deleted edges will // remove all existing edges between two blocks. -template class GraphDiff { +template class GraphDiff { using UpdateMapType = SmallDenseMap>; UpdateMapType SuccInsert; UpdateMapType SuccDelete; @@ -102,7 +102,7 @@ public: GraphDiff() {} - GraphDiff(ArrayRef> Updates, bool InverseGraph = false) { + GraphDiff(ArrayRef> Updates) { SmallVector, 4> LegalizedUpdates; cfg::LegalizeUpdates(Updates, LegalizedUpdates, InverseGraph); for (auto U : LegalizedUpdates) { @@ -116,8 +116,7 @@ } } - bool ignoreChild(const NodePtr BB, NodePtr EdgeEnd, bool InverseEdge, - bool InverseGraph) const { + bool ignoreChild(const NodePtr BB, NodePtr EdgeEnd, bool InverseEdge) const { auto &DeleteChildren = (InverseEdge != InverseGraph) ? PredDelete : SuccDelete; auto It = DeleteChildren.find(BB); @@ -128,8 +127,7 @@ } iterator_range::const_iterator> - getAddedChildren(const NodePtr BB, bool InverseEdge, - bool InverseGraph) const { + getAddedChildren(const NodePtr BB, bool InverseEdge) const { auto &InsertChildren = (InverseEdge != InverseGraph) ? PredInsert : SuccInsert; auto It = InsertChildren.find(BB); @@ -159,7 +157,7 @@ }; template struct CFGViewSuccessors { - using DataRef = const GraphDiff *; + using DataRef = const GraphDiff *; using NodeRef = std::pair; using ExistingChildIterator = @@ -168,7 +166,7 @@ BasicBlock *BB; DeletedEdgesFilter(BasicBlock *BB) : BB(BB){}; bool operator()(NodeRef N) const { - return !N.first->ignoreChild(BB, N.second, false, InverseGraph); + return !N.first->ignoreChild(BB, N.second, false); } }; using FilterExistingChildrenIterator = @@ -182,7 +180,7 @@ AddNewChildrenIterator>; static ChildIteratorType child_begin(NodeRef N) { - auto InsertVec = N.first->getAddedChildren(N.second, false, InverseGraph); + auto InsertVec = N.first->getAddedChildren(N.second, false); // filter iterator init: auto firstit = make_filter_range( make_range({succ_begin(N.second), N.first}, @@ -197,7 +195,7 @@ } static ChildIteratorType child_end(NodeRef N) { - auto InsertVec = N.first->getAddedChildren(N.second, false, InverseGraph); + auto InsertVec = N.first->getAddedChildren(N.second, false); // filter iterator init: auto firstit = make_filter_range( make_range({succ_end(N.second), N.first}, @@ -213,7 +211,7 @@ }; template struct CFGViewPredecessors { - using DataRef = const GraphDiff *; + using DataRef = const GraphDiff *; using NodeRef = std::pair; using ExistingChildIterator = @@ -222,7 +220,7 @@ BasicBlock *BB; DeletedEdgesFilter(BasicBlock *BB) : BB(BB){}; bool operator()(NodeRef N) const { - return !N.first->ignoreChild(BB, N.second, true, InverseGraph); + return !N.first->ignoreChild(BB, N.second, true); } }; using FilterExistingChildrenIterator = @@ -236,7 +234,7 @@ AddNewChildrenIterator>; static ChildIteratorType child_begin(NodeRef N) { - auto InsertVec = N.first->getAddedChildren(N.second, true, InverseGraph); + auto InsertVec = N.first->getAddedChildren(N.second, true); // filter iterator init: auto firstit = make_filter_range( make_range({pred_begin(N.second), N.first}, @@ -251,7 +249,7 @@ } static ChildIteratorType child_end(NodeRef N) { - auto InsertVec = N.first->getAddedChildren(N.second, true, InverseGraph); + auto InsertVec = N.first->getAddedChildren(N.second, true); // filter iterator init: auto firstit = make_filter_range( make_range({pred_end(N.second), N.first}, @@ -267,19 +265,20 @@ }; template <> -struct GraphTraits *, BasicBlock *>> +struct GraphTraits< + std::pair *, BasicBlock *>> : CFGViewSuccessors {}; template <> struct GraphTraits< - std::pair> *, BasicBlock *>> + std::pair *, BasicBlock *>> : CFGViewSuccessors {}; template <> struct GraphTraits< - std::pair *, Inverse>> + std::pair *, Inverse>> : CFGViewPredecessors {}; template <> struct GraphTraits< - std::pair> *, Inverse>> + std::pair *, Inverse>> : CFGViewPredecessors {}; } // end namespace llvm