Skip to content

CodeGen/NewPM: Initialize MMI in NewPM path #99754

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions llvm/include/llvm/Passes/MachinePassRegistry.def
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define MODULE_ANALYSIS(NAME, CREATE_PASS)
#endif
MODULE_ANALYSIS("collector-metadata", CollectorMetadataAnalysis())
MODULE_ANALYSIS("machine-module-info", MachineModuleAnalysis())
MODULE_ANALYSIS("pass-instrumentation", PassInstrumentationAnalysis(PIC))
#undef MODULE_ANALYSIS

Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,8 @@ void SelectionDAGISel::initializeAnalysisResults(
FnVarLocs = &FAM.getResult<DebugAssignmentTrackingAnalysis>(Fn);

auto *UA = FAM.getCachedResult<UniformityInfoAnalysis>(Fn);
MMI = &MFAM.getResult<MachineModuleAnalysis>(*MF).getMMI();
Copy link
Contributor

Choose a reason for hiding this comment

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

IIUC it should be obtained from ModuleAnalysisManager or ModuleAnalysisManagerMachineFunctionProxy, but current ModuleAnalysisManagerMachineFunctionProxy is an OuterAnalysisManagerProxy.

off-topic: Ideally, it should be thread-safe to obtain module analysis results in machine function pass pipeline.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was expecting this to not compile if it wasn't going to work. I'm not sure how to get a ModuleAnalysisManager from the MachineFunctionAnalysisManager

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the registration is just not happening and I'm not sure why. I can't run the analysis standalone with -passes either

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ping. Is MachineModuleInfo just broken in new PM?

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
MMI = &MFAM.getResult<MachineModuleAnalysis>(*MF).getMMI();
MMI = MFAM.getResult<ModuleAnalysisManagerMachineFunctionProxy>(*MF)
.getCachedResult<MachineModuleAnalysis>(*MF->getFunction().getParent());


CurDAG->init(*MF, *ORE, MFAM, LibInfo, UA, PSI, BFI, *MMI, FnVarLocs);

// Now get the optional analyzes if we want to.
Expand Down
Loading