[llvm-branch-commits] [llvm] [CodeGen][NPM] Port XRayInstrumentation to NPM (PR #129865)

Akshat Oke via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Mar 11 22:53:26 PDT 2025


================
@@ -143,11 +170,43 @@ void XRayInstrumentation::prependRetWithPatchableExit(
     }
 }
 
-bool XRayInstrumentation::runOnMachineFunction(MachineFunction &MF) {
+PreservedAnalyses
+XRayInstrumentationPass::run(MachineFunction &MF,
+                             MachineFunctionAnalysisManager &MFAM) {
+  MachineDominatorTree *MDT = nullptr;
+  MachineLoopInfo *MLI = nullptr;
+
+  if (XRayInstrumentation::needMDTAndMLIAnalyses(MF.getFunction())) {
+    MDT = MFAM.getCachedResult<MachineDominatorTreeAnalysis>(MF);
+    MLI = MFAM.getCachedResult<MachineLoopAnalysis>(MF);
----------------
optimisan wrote:

Legacy pass is calling `getAnalysisIfAvailable` on these, so I used `getCachedResult`

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


More information about the llvm-branch-commits mailing list