[llvm] [AMDGPU][NewPM] Port SIFixVGPRCopies to NPM (PR #123592)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 20 03:38:55 PST 2025


================
@@ -41,15 +41,31 @@ class SIFixVGPRCopies : public MachineFunctionPass {
   StringRef getPassName() const override { return "SI Fix VGPR copies"; }
 };
 
+class SIFixVGPRCopies {
+public:
+  bool run(MachineFunction &MF);
+};
+
 } // End anonymous namespace.
 
-INITIALIZE_PASS(SIFixVGPRCopies, DEBUG_TYPE, "SI Fix VGPR copies", false, false)
+INITIALIZE_PASS(SIFixVGPRCopiesLegacy, DEBUG_TYPE, "SI Fix VGPR copies", false,
+                false)
 
-char SIFixVGPRCopies::ID = 0;
+char SIFixVGPRCopiesLegacy::ID = 0;
 
-char &llvm::SIFixVGPRCopiesID = SIFixVGPRCopies::ID;
+char &llvm::SIFixVGPRCopiesID = SIFixVGPRCopiesLegacy::ID;
+
+PreservedAnalyses SIFixVGPRCopiesPass::run(MachineFunction &MF,
+                                           MachineFunctionAnalysisManager &) {
+  SIFixVGPRCopies().run(MF);
+  return PreservedAnalyses::all();
----------------
jayfoad wrote:

Why is it OK to return `all` unconditionally?

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


More information about the llvm-commits mailing list