Skip to content
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

[NewPM] Add FunctionToMachineFunctionPassAdaptor #88711

Closed
wants to merge 1 commit into from

Conversation

paperchalice
Copy link
Contributor

Add FunctionToMachineFunctionPassAdaptor, currently codegen pipeline has the pattern module->function->machine-function if MachineOutlinerPass is not enabled. This adaptor allows FreeMachineFunction to be a function pass, then we don't need to handle function analyses invalidation in MachinePassManager etc.
Stacked on #88610.
Issue: #84397.

//
// Once function changed by a non-trivial pass, we need to do instruction
// selection again.
auto PAC = PA.getChecker<FunctionAnalysisManagerModuleProxy>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const &?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this returns a PreservedAnalysisChecker, so it's fine as is

Copy link
Contributor

@aeubanks aeubanks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a test using this in llvm/unittests/CodeGen/PassManagerTest.cpp?

llvm/lib/CodeGen/MachinePassManager.cpp Show resolved Hide resolved
//
// Once function changed by a non-trivial pass, we need to do instruction
// selection again.
auto PAC = PA.getChecker<FunctionAnalysisManagerModuleProxy>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this returns a PreservedAnalysisChecker, so it's fine as is

// If this proxy isn't marked as preserved, then even if the result remains
// valid, the key itself may no longer be valid, so we clear everything.
//
// Once function changed by a non-trivial pass, we need to do instruction
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this something that actually happens? I thought once we're done with codegen, we're basically done with the IR as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This never happened, MachineOutliner just only create dummy IR functions to get associated machine functions.

@paperchalice paperchalice force-pushed the adaptor branch 2 times, most recently from b6058e0 to e404d6d Compare April 16, 2024 07:00
// Clear out the analysis manager if we're being destroyed -- it means we
// didn't even see an invalidate call when we got invalidated.
FAM->clear();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes destruction issue when destruct analysis managers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants