[PATCH] D156618: [IR] Fix a memory leak if Function::dropAllReferences() is followed by setHungoffOperand
Liqiang Tao via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 14 08:20:21 PDT 2023
taolq added a comment.
In D156618#4639976 <https://reviews.llvm.org/D156618#4639976>, @dexonsmith wrote:
> I looked at the documentation for `User::dropAllReferences()`, which this overrides. That has strengthened my opinion so I'm requesting changes.
>
> Here are the docs:
>
> /// Drop all references to operands.
> ///
> /// This function is in charge of "letting go" of all objects that this User
> /// refers to. This allows one to 'delete' a whole class at a time, even
> /// though there may be circular references... First all references are
> /// dropped, and all use counts go to zero. Then everything is deleted for
> /// real. Note that no operations are valid on an object that has "dropped
> /// all references", except operator delete.
>
> I don't think it's appropriate for the `Function` override to behave differently.
>
> Instead, it looks like `Function::deleteBody()` should stop calling `dropAllReferences()`. Probably a private helper could be extracted from `dropAllReferences()` since you'd want to do almost all the same things (except, don't call `User::dropAllReferences()`, and do add references to `ptr null`).
>
> In D156618#4637792 <https://reviews.llvm.org/D156618#4637792>, @taolq wrote:
>
>>> What is "dector"?
>>
>> I made a typo. I mean dtor, destructor.
>
> Thanks, I probably should have guessed that!
Okay, I got your point. How about this version? Look forward for your reviewing.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156618/new/
https://reviews.llvm.org/D156618
More information about the llvm-commits
mailing list