[llvm] [CodeGen] Port dot-machine-cfg to new pass manager (PR #195901)

via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 09:33:33 PDT 2026


================
@@ -91,3 +92,15 @@ bool MachineCFGPrinter::runOnMachineFunction(MachineFunction &MF) {
   writeMCFGToDotFile(MF);
   return false;
 }
+
+PreservedAnalyses
+MachineCFGPrinterPass::run(MachineFunction &MF,
+                           MachineFunctionAnalysisManager &MFAM) {
+  if (!MCFGFuncName.empty() && !MF.getName().contains(MCFGFuncName))
+    return PreservedAnalyses::all();
+  errs() << "Writing Machine CFG for function ";
+  errs().write_escaped(MF.getName()) << '\n';
+
+  writeMCFGToDotFile(MF);
+  return getMachineFunctionPassPreservedAnalyses().preserveSet<CFGAnalyses>();
----------------
juanvazquez wrote:

ah thanks! 

I've updated the new pass then to do return `PreservedAnalyses::all()` and marking this as resolved. 

I'm keeping the legacy pass as is for now, if that's ok. Feel free to reopen otherwise, of course.

https://github.com/llvm/llvm-project/pull/195901


More information about the llvm-commits mailing list