未验证 提交 8acbf10b 编写于 作者: Z zhangbo9674 提交者: GitHub

fix ir program delete bug (#53978)

上级 5c10be4f
......@@ -95,13 +95,10 @@ void Operation::destroy() {
// release the uses of this result
detail::OpOperandImpl *first_use =
reinterpret_cast<detail::OpResultImpl *>(base_ptr)->first_use();
if (first_use != nullptr) {
first_use->release_source();
detail::OpOperandImpl *next_use = first_use->next_use();
while (next_use != nullptr) {
next_use->release_source();
next_use = next_use->next_use();
}
while (first_use != nullptr) {
first_use->remove_from_ud_chain();
first_use =
reinterpret_cast<detail::OpResultImpl *>(base_ptr)->first_use();
}
// destory the result
if (idx > max_inline_result_num) {
......
......@@ -133,6 +133,9 @@ void OpOperandImpl::remove_from_ud_chain() {
if (next_use_) {
next_use_->prev_use_addr_ = prev_use_addr_;
}
next_use_ = nullptr;
prev_use_addr_ = nullptr;
release_source();
}
OpOperandImpl::~OpOperandImpl() { remove_from_ud_chain(); }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册