!49010 clear record debug info

Merge pull request !49010 from huanghui/opt-record-debug-info
This commit is contained in:
i-robot 2023-02-23 10:56:08 +00:00 committed by Gitee
commit c7d809511a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 6 additions and 7 deletions

View File

@ -391,6 +391,8 @@ bool SimpleRewriter::Run() {
add_todo(fg->return_node());
}
}
TraceGuard trace_guard(std::make_shared<TraceOpt>(node->debug_info()));
ScopeGuard scope_guard(node->scope());
auto new_node = NodeRewrite(node);
if (new_node != nullptr) {
(void)manager_->Replace(node, new_node);

View File

@ -850,7 +850,6 @@ bool VmOptimizeAction(const ResourcePtr &resource) {
}
#endif
auto ret = OptimizeAction(resource, kVmPasses);
TraceManager::ClearParseOrResolveDebugInfo();
TraceManager::CloseRecordDebugInfoFlag();
return ret;
}

View File

@ -775,7 +775,6 @@ FunctionBlockPtr Parser::ParseStatement(const FunctionBlockPtr &block, const py:
MS_LOG(DEBUG) << "Ast node is " << node_name;
if (stmt_method_map_.count(node_name) != 0) {
auto stmt_block = (this->*stmt_method_map_[node_name])(block, node);
TraceManager::ClearParseOrResolveDebugInfo();
return stmt_block;
} else {
errcode_ = PARSE_NODE_METHOD_UNSUPPORTED;
@ -799,7 +798,6 @@ AnfNodePtr Parser::ParseExprNode(const FunctionBlockPtr &block, const py::object
MS_LOG(DEBUG) << "Ast node is " << node_name;
if (expr_method_map_.count(node_name) != 0) {
auto expr_node = (this->*expr_method_map_[node_name])(block, node);
TraceManager::ClearParseOrResolveDebugInfo();
return expr_node;
} else {
errcode_ = PARSE_NODE_METHOD_UNSUPPORTED;

View File

@ -517,7 +517,6 @@ AnfNodePtr ResolveCellWithAttr(const FuncGraphManagerPtr &manager, const py::obj
AnfNodePtrList inputs = {NewValueNode(prim::kPrimGetAttr), resolved_node, attr};
MS_EXCEPTION_IF_NULL(get_attr_node->func_graph());
AnfNodePtr res_node = get_attr_node->func_graph()->NewCNodeInOrder(std::move(inputs));
TraceManager::ClearParseOrResolveDebugInfo();
return res_node;
}
@ -533,7 +532,6 @@ AnfNodePtr ResolveCellWithAttr(const FuncGraphManagerPtr &manager, const py::obj
AnfNodePtrList inputs = {NewValueNode(prim::kPrimResolve), NewValueNode(new_namespace), NewValueNode(new_symbol)};
MS_EXCEPTION_IF_NULL(get_attr_node->func_graph());
AnfNodePtr resolved_node = get_attr_node->func_graph()->NewCNodeInOrder(std::move(inputs));
TraceManager::ClearParseOrResolveDebugInfo();
return resolved_node;
}
@ -718,7 +716,6 @@ AnfNodePtr ResolveMsClassWithAttr(const FuncGraphManagerPtr &manager, const py::
}
py::object attr_obj = py::getattr(cls_obj, common::SafeCStr(attr));
AnfNodePtr res_node = ResolveObjectAndAddToManager(manager, attr_obj, get_attr_node);
TraceManager::ClearParseOrResolveDebugInfo();
return res_node;
}

View File

@ -190,7 +190,10 @@ void TraceManager::DebugTrace(const DebugInfoPtr &debug_info, const TraceInfoPtr
(void)trace_context_stack_.emplace_back(cloned_info);
}
void TraceManager::EndTrace() noexcept { trace_context_stack_.pop_back(); }
void TraceManager::EndTrace() noexcept {
trace_context_stack_.pop_back();
ClearParseOrResolveDebugInfo();
}
DebugInfoPtr TraceManager::record_debug_info() { return record_debug_info_; }