| 704 | } |
| 705 | |
| 706 | void Differ::MatchIds( |
| 707 | PotentialIdMap& potential, |
| 708 | std::function<bool(const opt::Instruction*, const opt::Instruction*)> |
| 709 | match) { |
| 710 | for (size_t src_index = 0; src_index < potential.src_ids.size(); |
| 711 | ++src_index) { |
| 712 | for (size_t dst_index = 0; dst_index < potential.dst_ids.size(); |
| 713 | ++dst_index) { |
| 714 | const uint32_t src_id = potential.src_ids[src_index]; |
| 715 | const uint32_t dst_id = potential.dst_ids[dst_index]; |
| 716 | |
| 717 | if (dst_id == 0) { |
| 718 | // Already matched. |
| 719 | continue; |
| 720 | } |
| 721 | |
| 722 | const opt::Instruction* src_inst = src_id_to_.inst_map_[src_id]; |
| 723 | const opt::Instruction* dst_inst = dst_id_to_.inst_map_[dst_id]; |
| 724 | |
| 725 | if (match(src_inst, dst_inst)) { |
| 726 | id_map_.MapIds(src_id, dst_id); |
| 727 | |
| 728 | // Remove the ids from the potential list. |
| 729 | potential.src_ids[src_index] = 0; |
| 730 | potential.dst_ids[dst_index] = 0; |
| 731 | |
| 732 | // Find a match for the next src id. |
| 733 | break; |
| 734 | } |
| 735 | } |
| 736 | } |
| 737 | |
| 738 | // Remove matched ids to make the next iteration faster. |
| 739 | CompactIds(potential.src_ids); |
| 740 | CompactIds(potential.dst_ids); |
| 741 | } |
| 742 | |
| 743 | void Differ::MatchPreambleInstructions( |
| 744 | opt::IteratorRange<opt::Module::const_inst_iterator> src_insts, |
nothing calls this directly
no test coverage detected