| 258 | } |
| 259 | |
| 260 | void IRContext::CollectNonSemanticTree( |
| 261 | Instruction* inst, std::unordered_set<Instruction*>* to_kill) { |
| 262 | if (!inst->HasResultId()) return; |
| 263 | // Debug[No]Line result id is not used, so we are done |
| 264 | if (inst->IsDebugLineInst()) return; |
| 265 | std::vector<Instruction*> work_list; |
| 266 | std::unordered_set<Instruction*> seen; |
| 267 | work_list.push_back(inst); |
| 268 | |
| 269 | while (!work_list.empty()) { |
| 270 | auto* i = work_list.back(); |
| 271 | work_list.pop_back(); |
| 272 | get_def_use_mgr()->ForEachUser( |
| 273 | i, [&work_list, to_kill, &seen](Instruction* user) { |
| 274 | if (user->IsNonSemanticInstruction() && seen.insert(user).second) { |
| 275 | work_list.push_back(user); |
| 276 | to_kill->insert(user); |
| 277 | } |
| 278 | }); |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | bool IRContext::KillDef(uint32_t id) { |
| 283 | Instruction* def = get_def_use_mgr()->GetDef(id); |
no test coverage detected