| 3038 | // cycle was detected, and true otherwise. |
| 3039 | template <typename Visitor> |
| 3040 | inline bool PushDFSChild(Visitor* visitor, DFSStack* dfs_stack, |
| 3041 | HloInstruction* child) { |
| 3042 | CHECK(child != nullptr); |
| 3043 | const int id = child->unique_id(); |
| 3044 | CHECK_GE(id, 0) << "instruction may not have a parent computation"; |
| 3045 | switch (visitor->GetVisitState(id)) { |
| 3046 | case Visitor::kVisiting: |
| 3047 | return false; |
| 3048 | |
| 3049 | case Visitor::kVisited: |
| 3050 | // Nothing to do |
| 3051 | return true; |
| 3052 | |
| 3053 | case Visitor::kNotVisited: |
| 3054 | dfs_stack->push_back(std::make_pair(id, child)); |
| 3055 | return true; |
| 3056 | } |
| 3057 | } |
| 3058 | |
| 3059 | using InternalCompareFunction = |
| 3060 | std::function<bool(std::pair<int, const HloInstruction*>, |
no test coverage detected