| 848 | |
| 849 | template <typename T> |
| 850 | void MutableGraphView::ReplaceNodeFanouts(MutableNodeView* node, T* fanouts) { |
| 851 | node->num_regular_fanouts_ = fanouts->num_regular_fanouts_; |
| 852 | node->regular_fanouts_by_port_ = std::move(fanouts->regular_fanouts_by_port_); |
| 853 | for (size_t i = 0; i < node->regular_fanouts_by_port_.size(); ++i) { |
| 854 | for (size_t j = 0; j < node->regular_fanouts_by_port_[i].size(); ++j) { |
| 855 | auto& fanout = node->regular_fanouts_by_port_[i][j]; |
| 856 | auto* fanout_node_view = fanout.node_view(); |
| 857 | auto& fanout_fanin = fanout_node_view->regular_fanins_[fanout.index()]; |
| 858 | auto* fanout_fanins_count = &fanout_node_view->fanins_count_; |
| 859 | DecrementFaninCount( |
| 860 | fanout_fanins_count, |
| 861 | {&graph_->node(fanout_fanin.node_index_), fanout_fanin.index()}); |
| 862 | fanout_fanin.node_index_ = node->node_index_; |
| 863 | IncrementFaninCount( |
| 864 | fanout_fanins_count, |
| 865 | {&graph_->node(node->node_index_), fanout_fanin.index()}); |
| 866 | } |
| 867 | } |
| 868 | node->controlled_fanouts_ = std::move(fanouts->controlled_fanouts_); |
| 869 | for (size_t i = 0; i < node->controlled_fanouts_.size(); ++i) { |
| 870 | auto& fanout = node->controlled_fanouts_[i]; |
| 871 | auto* fanout_node_view = fanout.node_view(); |
| 872 | auto& fanout_fanin = |
| 873 | fanout_node_view->controlling_fanins_[fanout.fanin_index_]; |
| 874 | auto* fanout_fanins_count = &fanout_node_view->fanins_count_; |
| 875 | DecrementFaninCount( |
| 876 | fanout_fanins_count, |
| 877 | {&graph_->node(fanout_fanin.node_index_), Graph::kControlSlot}); |
| 878 | fanout_fanin.node_index_ = node->node_index_; |
| 879 | fanout_fanin.fanout_index_ = i; |
| 880 | IncrementFaninCount(fanout_fanins_count, {&graph_->node(node->node_index_), |
| 881 | Graph::kControlSlot}); |
| 882 | } |
| 883 | } |
| 884 | |
| 885 | void MutableGraphView::FixRenamedNodes( |
| 886 | std::vector<RenamedOrOverwrittenNode>* renamed_nodes, |
nothing calls this directly
no test coverage detected