[llvm-branch-commits] [X86][NewPM] Port X86FlagsCopyLowering to NPM (PR #173752)
Alexis Engelke via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Dec 29 00:02:25 PST 2025
================
@@ -945,3 +951,18 @@ void X86FlagsCopyLoweringPass::rewriteMI(MachineBasicBlock &MBB,
MI.findRegisterUseOperand(X86::EFLAGS, /*TRI=*/nullptr)->setIsKill(true);
LLVM_DEBUG(dbgs() << " fixed instruction: "; MI.dump());
}
+
+bool X86FlagsCopyLoweringLegacy::runOnMachineFunction(MachineFunction &MF) {
+ auto *MDTWrapper = getAnalysisIfAvailable<MachineDominatorTreeWrapperPass>();
+ MachineDominatorTree *MDT = MDTWrapper ? &MDTWrapper->getDomTree() : nullptr;
+ return X86FlagsCopyLoweringImpl(MDT).runOnMachineFunction(MF);
+}
+
+PreservedAnalyses
+X86FlagsCopyLoweringPass::run(MachineFunction &MF,
+ MachineFunctionAnalysisManager &MFAM) {
+ MachineDominatorTree *MDT = &MFAM.getResult<MachineDominatorTreeAnalysis>(MF);
----------------
aengelke wrote:
> so OwnedMDT is redundant for new pass manager version and using getResult is acceptable.
Only if getResult would be called in the middle of runOnMachineFunction, which is difficult to implement when supporting legacy and new pass manager at the same time.
https://github.com/llvm/llvm-project/pull/173752
More information about the llvm-branch-commits
mailing list