================ @@ -4241,7 +4259,33 @@ void RegisterCoalescer::releaseMemory() { LargeLIVisitCounter.clear(); } -bool RegisterCoalescer::runOnMachineFunction(MachineFunction &fn) { +PreservedAnalyses +RegisterCoalescerPass::run(MachineFunction &MF, + MachineFunctionAnalysisManager &MFAM) { + auto &LIS = MFAM.getResult<LiveIntervalsAnalysis>(MF); + auto &Loops = MFAM.getResult<MachineLoopAnalysis>(MF); + auto *SI = MFAM.getCachedResult<SlotIndexesAnalysis>(MF); + RegisterCoalescer Impl(&LIS, SI, &Loops); + if (!Impl.run(MF)) + return PreservedAnalyses::all(); + auto PA = getMachineFunctionPassPreservedAnalyses(); + PA.preserve<LiveIntervalsAnalysis>(); + PA.preserve<SlotIndexesAnalysis>(); + PA.preserve<MachineLoopAnalysis>(); + PA.preserve<MachineDominatorTreeAnalysis>(); + return PA; +} + +bool RegisterCoalescerLegacy::runOnMachineFunction(MachineFunction &MF) { + auto *LIS = &getAnalysis<LiveIntervalsWrapperPass>().getLIS(); + auto *Loops = &getAnalysis<MachineLoopInfoWrapperPass>().getLI(); + auto *SIWrapper = getAnalysisIfAvailable<SlotIndexesWrapperPass>(); + SlotIndexes *SI = SIWrapper ? &SIWrapper->getSI() : nullptr; + Impl.reset(new RegisterCoalescer(LIS, SI, Loops)); ---------------- arsenm wrote:
Don't see why this needs heap allocation https://github.com/llvm/llvm-project/pull/124698 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits