| 729 | } |
| 730 | |
| 731 | void DebugInfoManager::ClearDebugInfo(Instruction* instr) { |
| 732 | auto scope_id_to_users_itr = |
| 733 | scope_id_to_users_.find(instr->GetDebugScope().GetLexicalScope()); |
| 734 | if (scope_id_to_users_itr != scope_id_to_users_.end()) { |
| 735 | scope_id_to_users_itr->second.erase(instr); |
| 736 | } |
| 737 | auto inlinedat_id_to_users_itr = |
| 738 | inlinedat_id_to_users_.find(instr->GetDebugInlinedAt()); |
| 739 | if (inlinedat_id_to_users_itr != inlinedat_id_to_users_.end()) { |
| 740 | inlinedat_id_to_users_itr->second.erase(instr); |
| 741 | } |
| 742 | |
| 743 | if (instr == nullptr || !instr->IsOpenCL100DebugInstr()) { |
| 744 | return; |
| 745 | } |
| 746 | |
| 747 | id_to_dbg_inst_.erase(instr->result_id()); |
| 748 | |
| 749 | if (instr->GetOpenCL100DebugOpcode() == OpenCLDebugInfo100DebugFunction) { |
| 750 | auto fn_id = |
| 751 | instr->GetSingleWordOperand(kDebugFunctionOperandFunctionIndex); |
| 752 | fn_id_to_dbg_fn_.erase(fn_id); |
| 753 | } |
| 754 | |
| 755 | if (instr->GetOpenCL100DebugOpcode() == OpenCLDebugInfo100DebugDeclare || |
| 756 | instr->GetOpenCL100DebugOpcode() == OpenCLDebugInfo100DebugValue) { |
| 757 | auto var_or_value_id = |
| 758 | instr->GetSingleWordOperand(kDebugDeclareOperandVariableIndex); |
| 759 | auto dbg_decl_itr = var_id_to_dbg_decl_.find(var_or_value_id); |
| 760 | if (dbg_decl_itr != var_id_to_dbg_decl_.end()) { |
| 761 | dbg_decl_itr->second.erase(instr); |
| 762 | } |
| 763 | } |
| 764 | |
| 765 | if (deref_operation_ == instr) { |
| 766 | deref_operation_ = nullptr; |
| 767 | for (auto dbg_instr_itr = context()->module()->ext_inst_debuginfo_begin(); |
| 768 | dbg_instr_itr != context()->module()->ext_inst_debuginfo_end(); |
| 769 | ++dbg_instr_itr) { |
| 770 | if (instr != &*dbg_instr_itr && |
| 771 | dbg_instr_itr->GetOpenCL100DebugOpcode() == |
| 772 | OpenCLDebugInfo100DebugOperation && |
| 773 | dbg_instr_itr->GetSingleWordOperand( |
| 774 | kDebugOperationOperandOperationIndex) == |
| 775 | OpenCLDebugInfo100Deref) { |
| 776 | deref_operation_ = &*dbg_instr_itr; |
| 777 | break; |
| 778 | } |
| 779 | } |
| 780 | } |
| 781 | |
| 782 | if (debug_info_none_inst_ == instr) { |
| 783 | debug_info_none_inst_ = nullptr; |
| 784 | for (auto dbg_instr_itr = context()->module()->ext_inst_debuginfo_begin(); |
| 785 | dbg_instr_itr != context()->module()->ext_inst_debuginfo_end(); |
| 786 | ++dbg_instr_itr) { |
| 787 | if (instr != &*dbg_instr_itr && |
| 788 | dbg_instr_itr->GetOpenCL100DebugOpcode() == |
no test coverage detected