提交 b84df55a 编写于 作者: Y Yanzhan Yang 提交者: GitHub

fix fetch var memory optimization bug (#1746)

上级 9ac40781
......@@ -118,10 +118,6 @@ void MemoryOptPass::operator()(
}
}
for (const auto &node : fetch_var_nodes) {
analysis_nodes_.push(node);
}
// apply optimize
while (!analysis_nodes_.empty()) {
auto *node = analysis_nodes_.top();
......@@ -132,7 +128,9 @@ void MemoryOptPass::operator()(
bool reused = false;
// find out a possable reuse list
for (auto &list : reused_nodes_) {
if (list.back()->count == 0) {
if (list.back()->count == 0 &&
std::find(fetch_var_nodes.begin(), fetch_var_nodes.end(),
list.back()) == fetch_var_nodes.end()) {
list.push_back(node);
reused = true;
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册