-
Notifications
You must be signed in to change notification settings - Fork 10.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
[CodeGen] Port FreeMachineFunction to new pass manager #79421
[CodeGen] Port FreeMachineFunction to new pass manager #79421
Conversation
@@ -125,8 +125,8 @@ MACHINE_FUNCTION_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis, | |||
#ifndef MACHINE_FUNCTION_PASS | |||
#define MACHINE_FUNCTION_PASS(NAME, PASS_NAME, CONSTRUCTOR) | |||
#endif | |||
MACHINE_FUNCTION_PASS("free-machine-function", FreeMachineFunctionPass, ()) |
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.
do we somehow block running this with -run-pass? What happens if you manually run this on its own or before other passes?
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.
In theory we should never run this pass manually, MachineFunctionPassManager
will always create a machine function (by getOrCreateMachineFunction). Or we shouldn't expose this pass , like BitcodeWriterPass
.
the intention with FreeMachineFunction is to be able to not have all MFs in memory at once right? however, any module pass in the pipeline breaks that since we'll run passes on every machine function before the module pass for example, there was a module pass unconditionally added to every codegen pipeline until 2021 in https://reviews.llvm.org/D99707. that makes me wonder, should we just give up on the idea of the FreeMachineFunction pass for simplification, and instead just free all the machine functions at once somehow? |
May need memory profile here, IIRC this is a memory space trade-off (https://discourse.llvm.org/t/rfc-introducing-classes-for-the-codegen-driven-by-new-pass-manager/55877/19). |
This pass should be the last machine function pass in pipeline, also ignore
PI.runAfterPass(*P, MF, PassPA);
to avoid accessing a dangling reference.