-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
passManager should always call releaseMemory to avoid use-after-free bugs #4770
Comments
assigned to @edwintorok |
Watch out for extra white spaces in the patch. Do you really need wasRun? Isn't Changed enough ? Otherwise the patch looks good. |
I'll clean them up.
wasRun is needed to make sure that releaseMemory isn't called before the first Changed isn't always set to true after a run(), and yet the pass could have allocated memory.
Thanks, I'll apply the patch. |
The patch is applied, right? Is this bug fixed? |
I should've closed the bug after applying the patch, thanks for reminding. |
Extended Description
Currently some passes call releaseMemory (or their equivalent) in their run function, some don't (for example ScalarEvolution).
According to the documentation "This method is called after the run* method for the class, before the next call of run* in your pass."
However the PassManager doesn't do this for on-the-fly passes, which can cause use-after-free bugs if you are using ScalarEvolution from a ModulePass
(LoopInfo is rerun, but ScalarEvolution still has stale data from the previous LoopInfo run).
As discusses on llvm-commits the following should happen:
The text was updated successfully, but these errors were encountered: