================ @@ -276,16 +288,49 @@ void VirtRegRewriter::getAnalysisUsage(AnalysisUsage &AU) const { MachineFunctionPass::getAnalysisUsage(AU); } -bool VirtRegRewriter::runOnMachineFunction(MachineFunction &fn) { +bool VirtRegRewriterLegacy::runOnMachineFunction(MachineFunction &MF) { + VirtRegMap &VRM = getAnalysis<VirtRegMapWrapperLegacy>().getVRM(); + LiveIntervals &LIS = getAnalysis<LiveIntervalsWrapperPass>().getLIS(); + LiveRegMatrix &LRM = getAnalysis<LiveRegMatrixWrapperLegacy>().getLRM(); + SlotIndexes &Indexes = getAnalysis<SlotIndexesWrapperPass>().getSI(); + LiveDebugVariables &DebugVars = + getAnalysis<LiveDebugVariablesWrapperLegacy>().getLDV(); + + VirtRegRewriter R(ClearVirtRegs, &Indexes, &LIS, &LRM, &VRM, &DebugVars); + return R.run(MF); +} + +PreservedAnalyses +VirtRegRewriterPass::run(MachineFunction &MF, + MachineFunctionAnalysisManager &MFAM) { + VirtRegMap &VRM = MFAM.getResult<VirtRegMapAnalysis>(MF); + LiveIntervals &LIS = MFAM.getResult<LiveIntervalsAnalysis>(MF); + LiveRegMatrix &LRM = MFAM.getResult<LiveRegMatrixAnalysis>(MF); + SlotIndexes &Indexes = MFAM.getResult<SlotIndexesAnalysis>(MF); + LiveDebugVariables &DebugVars = + MFAM.getResult<LiveDebugVariablesAnalysis>(MF); + + VirtRegRewriter R(ClearVirtRegs, &Indexes, &LIS, &LRM, &VRM, &DebugVars); + if (!R.run(MF)) + return PreservedAnalyses::all(); + auto PA = getMachineFunctionPassPreservedAnalyses(); ---------------- cdevadas wrote:
```suggestion return PreservedAnalyses::all(); auto PA = getMachineFunctionPassPreservedAnalyses(); ``` https://github.com/llvm/llvm-project/pull/130564 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits