-
Notifications
You must be signed in to change notification settings - Fork 14k
[Transforms] Add LifetimeMovePass #144319
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
base: main
Are you sure you want to change the base?
Conversation
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.
Just some quick drive-by notes. Can this pass result in observable changes to allocation addresses?
|
||
def int_coro_await_suspend_handle : Intrinsic<[], | ||
[llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty], | ||
[Throws]>; | ||
[Throws, NoCapture<ArgIndex<0>>]>; |
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.
This should be a separate change.
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.
OK. I will separate it before landing this patch. Temporarily keep it so that CI looks good.
Co-authored-by: Nikita Popov <github@npopov.com>
(I didn't take a real look yet) We shouldn't put |
No. This pass shall not introduce changes to allocation addresses. |
As suggested by @ChuanqiXu9 in #143333 , I propose LifetimeMovePass, which was previously part of the CoroSplit pass, should now appear as a general pass. Lifetime markers determine whether we place alloca on the frame or on the stack. By moving these markers to optimized positions, we can reduce the coroutine frame size, leading to significant memory savings.
The LifetimeMovePass is positioned between SimplifyCFG and InstCombine. Currently, it only applies to pre-split coroutines, as I have not yet developed a concrete plan for its interaction with non-coroutine code. This patch is WIP, feel free to share your feedback or suggestions.
Close #49716