| 1015 | } |
| 1016 | |
| 1017 | StatusOr<StateMap::CondId> FunctionalizeCond::JoinCondStatesNonMerge( |
| 1018 | StateMap::CondId src, StateMap::CondId dst) { |
| 1019 | VLOG(5) << "Joining src=" << DebugString(src) << " [" << src |
| 1020 | << "] and dst=" << DebugString(dst) << " [" << dst << "]"; |
| 1021 | |
| 1022 | if (state_map_.IsEmpty(dst) || state_map_.IsDead(src)) return src; |
| 1023 | if (state_map_.IsDead(dst) || state_map_.IsEmpty(src)) return dst; |
| 1024 | |
| 1025 | // Nothing to do if the CondState is the same. |
| 1026 | if (src == dst) return src; |
| 1027 | |
| 1028 | StateMap::CondState both = *src; |
| 1029 | for (const auto& kv : *dst) { |
| 1030 | auto it = both.find(kv.first); |
| 1031 | if (it == both.end()) { |
| 1032 | both.insert(kv); |
| 1033 | } else { |
| 1034 | if (it->second != kv.second) { |
| 1035 | if (it->second == BranchType::kNeither) { |
| 1036 | // BranchType for 'src' is kNeither. Use the BranchType in 'dst'. |
| 1037 | it->second = kv.second; |
| 1038 | } else if (kv.second == BranchType::kNeither) { |
| 1039 | // BranchType for 'dst' is kNeither. Use the BranchType in 'src'. |
| 1040 | // No need to change it->second. |
| 1041 | } else { |
| 1042 | return errors::InvalidArgument( |
| 1043 | "Graph contains node with inputs predicated on incompatible " |
| 1044 | "predicates: ", |
| 1045 | DebugString(src), " and ", DebugString(dst)); |
| 1046 | } |
| 1047 | } |
| 1048 | } |
| 1049 | } |
| 1050 | return state_map_.GetCondId(both); |
| 1051 | } |
| 1052 | |
| 1053 | StatusOr<StateMap::CondId> FunctionalizeCond::JoinCondStatesMerge( |
| 1054 | Node* merge, StateMap::CondId src, StateMap::CondId dst) { |
nothing calls this directly
no test coverage detected