[llvm] [AMDGPU][NPM] Preserve analyses in AMDGPURewriteAGPRCopyMFMA for NPM (PR #170130)

Christudasan Devadasan via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 1 08:38:32 PST 2025


================
@@ -659,7 +660,11 @@ AMDGPURewriteAGPRCopyMFMAPass::run(MachineFunction &MF,
   if (!Impl.run(MF))
     return PreservedAnalyses::all();
   auto PA = getMachineFunctionPassPreservedAnalyses();
-  PA.preserveSet<CFGAnalyses>();
-  PA.preserve<LiveStacksAnalysis>();
+  PA.preserveSet<CFGAnalyses>()
+      .preserve<LiveStacksAnalysis>()
+      .preserve<VirtRegMapAnalysis>()
+      .preserve<SlotIndexesAnalysis>()
----------------
cdevadas wrote:

I guess SlotIndex is not directly used here, but invoked inside LiveIntervals?
It doesn't seem good to me to explicitly preserve the analyses that aren't explicitly used in a pass. Rather, the pass manager should have some way to preserve them. In this case LiveIntervals analysis is preserved here. The pass-manager infrastructure should preserve the SlitIndex too. Anyway, it doesn't work that way at the moment.

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


More information about the llvm-commits mailing list