| 230 | } |
| 231 | |
| 232 | void DefUseManager::ClearInst(Instruction* inst) { |
| 233 | auto iter = inst_to_used_ids_.find(inst); |
| 234 | if (iter != inst_to_used_ids_.end()) { |
| 235 | EraseUseRecordsOfOperandIds(inst); |
| 236 | if (inst->result_id() != 0) { |
| 237 | // Remove all uses of this inst. |
| 238 | auto users_begin = UsersBegin(inst); |
| 239 | auto end = id_to_users_.end(); |
| 240 | auto new_end = users_begin; |
| 241 | for (; UsersNotEnd(new_end, end, inst); ++new_end) { |
| 242 | } |
| 243 | id_to_users_.erase(users_begin, new_end); |
| 244 | id_to_def_.erase(inst->result_id()); |
| 245 | } |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | void DefUseManager::EraseUseRecordsOfOperandIds(const Instruction* inst) { |
| 250 | // Go through all ids used by this instruction, remove this instruction's |
no test coverage detected