[llvm-branch-commits] [llvm] [CodeGen][NewPM] Port RegUsageInfoPropagation pass to NPM (PR #114010)

Akshat Oke via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Nov 4 01:58:49 PST 2024


================
@@ -95,12 +107,29 @@ static const Function *findCalledFunction(const Module &M,
   return nullptr;
 }
 
-bool RegUsageInfoPropagation::runOnMachineFunction(MachineFunction &MF) {
-  const Module &M = *MF.getFunction().getParent();
+bool RegUsageInfoPropagationLegacy::runOnMachineFunction(MachineFunction &MF) {
   PhysicalRegisterUsageInfo *PRUI =
       &getAnalysis<PhysicalRegisterUsageInfoWrapperLegacy>().getPRUI();
 
-  LLVM_DEBUG(dbgs() << " ++++++++++++++++++++ " << getPassName()
+  RegUsageInfoPropagation RUIP(PRUI);
+  return RUIP.run(MF);
+}
+
+PreservedAnalyses
+RegUsageInfoPropagationPass::run(MachineFunction &MF,
+                                 MachineFunctionAnalysisManager &MFAM) {
+  Module &MFA = *MF.getFunction().getParent();
+  auto *PRUI = MFAM.getResult<ModuleAnalysisManagerMachineFunctionProxy>(MF)
+                   .getCachedResult<PhysicalRegisterUsageAnalysis>(MFA);
+  assert(PRUI && "PhysicalRegisterUsageAnalysis not available");
----------------
optimisan wrote:

It is an outer analysis so cannot run it from an inner IR,

https://github.com/llvm/llvm-project/pull/114010


More information about the llvm-branch-commits mailing list