-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[NewPM] Introduce MFAnalysisGetter for a common analysis getter #116166
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
Conversation
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
197b28c
to
7e31c7d
Compare
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.
I liked the general direction. Do you have at least one analysis pass ported using this Getter?
MFAnalysisGetter(Pass *LegacyPass) : LegacyPass(LegacyPass) {} | ||
MFAnalysisGetter(MachineFunctionAnalysisManager *MFAM) : MFAM(MFAM) {} | ||
|
||
/// Outer analyses requested from NPM will be cached results and can be null |
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.
Ditto.
@@ -236,6 +238,82 @@ using MachineFunctionPassManager = PassManager<MachineFunction>; | |||
/// preserve. | |||
PreservedAnalyses getMachineFunctionPassPreservedAnalyses(); | |||
|
|||
/// For migrating to new pass manager |
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.
Full stop at the end of the comment.
template <typename AnalysisT> | ||
typename AnalysisT::Result *getAnalysis(MachineFunction &MF) { | ||
if (MFAM) { | ||
// need a proxy to get the result for outer analyses |
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.
Capitalize the first character.
68bcb36
to
be67756
Compare
125b82d
to
fa301f7
Compare
Updated MachineSink to use this #115434 |
be67756
to
751c8bf
Compare
fa301f7
to
9343a47
Compare
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.
I'd really rather not do this. With the new pass manager transition for the optimization pipeline, it was fine to not have this abstraction, and other similar abstractions between the legacy/new pass manager (CallGraphUpdater) have caused issues due to subtle differences between the legacy/new pass manager. We're just going to have to tear it down anyway if we remove the legacy pass manager.
I see. I saw this kind of abstraction being used in Attributor so thought I'd make it available here. |
With this, there is no need to both
getAnalysis<AnaT>()
andMFAM.getResult<AnaT>(MF)
to pass in analysis from legacy/new pass managers.Instead just pass the
MFAnalysisGetter
into the pass implementation and useAG.getAnalysis<AnaT>(MF)
once. It also detects outer analyses and routes it through the proxies itself.