-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SSADestroyHoisting] Split destroy from copy. #41497
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
[SSADestroyHoisting] Split destroy from copy. #41497
Conversation
As was done with store [init], transform instructions like copy_addr %n to %m into the sequence destroy_addr %m copy_addr %n to [initialization] %m in order to create more opportunities for hoisting destroys. After hoisting, if these opportunities for hoisting don't result in hoisting actually occurring, recombine the two instructions.
@swift-ci please benchmark |
@swift-ci please test |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I think this is fine. I just want to point out the trade-offs being made.
-
Recombining destroy_addr + copy_addr makes the pass non-repeatable. Ideally, a pass will be repeatable (isotropic?). If I run a pass. Then recompute all the analyses invalidated by the pass. Then I run the pass again. The second time around, no analyses should be invalidated. Also, memory allocation for instructions won't grow endlessly. It's probably fine in this case though for a pass that only runs a few times.
-
Not recombining destroy_addr + copy_addr results in extra runtime calls and might defeat some other analysis. I'm much more concerned the extra runtime calls.
So, this seems like the right approach. If we wanted to avoid recombining and make the split form canonical, then I think we would need a non-OSSA pass to do that just before IRGen.
/cc @eeckstein
[SSADestroyHoisting] Split destroy from copy.
As was done with store [init], transform instructions like
into the sequence
in order to create more opportunities for hoisting destroys.
After hoisting, if these opportunities for hoisting don't result in hoisting actually occurring, recombine the two instructions.