[llvm-branch-commits] [llvm] [CodeGen][NewPM] Port PeepholeOptimizer to NPM (PR #116326)
Akshat Oke via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Nov 15 00:52:35 PST 2024
================
@@ -1644,9 +1652,36 @@ bool PeepholeOptimizer::optimizeRecurrence(MachineInstr &PHI) {
return Changed;
}
-bool PeepholeOptimizer::runOnMachineFunction(MachineFunction &MF) {
+PreservedAnalyses
+PeepholeOptimizerPass::run(MachineFunction &MF,
+ MachineFunctionAnalysisManager &MFAM) {
+ MFPropsModifier _(*this, MF);
+ auto *DT =
+ Aggressive ? &MFAM.getResult<MachineDominatorTreeAnalysis>(MF) : nullptr;
+ auto *MLI = &MFAM.getResult<MachineLoopAnalysis>(MF);
+ PeepholeOptimizer Impl(DT, MLI);
+ bool Changed = Impl.run(MF);
+ if (!Changed)
+ return PreservedAnalyses::all();
+
+ auto PA = getMachineFunctionPassPreservedAnalyses();
+ PA.preserve<MachineDominatorTreeAnalysis>();
+ PA.preserve<MachineLoopAnalysis>();
----------------
optimisan wrote:
somehow missed that, done
https://github.com/llvm/llvm-project/pull/116326
More information about the llvm-branch-commits
mailing list