[llvm-branch-commits] [X86][NewPM] Port X86FlagsCopyLowering to NPM (PR #173752)
Alexis Engelke via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat Dec 27 23:22:08 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:
Shouldn't this be getCachedResult? Most of the time the pass won't use the MDT, so computing it is often unnecessary.
https://github.com/llvm/llvm-project/pull/173752
More information about the llvm-branch-commits
mailing list