[llvm] AMDGPU/NewPM: Port SIFoldOperands to new pass manager (PR #105801)

Christudasan Devadasan via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 02:36:24 PDT 2024


================
@@ -121,11 +121,23 @@ class SIFoldOperands : public MachineFunctionPass {
   bool tryOptimizeAGPRPhis(MachineBasicBlock &MBB);
 
 public:
-  SIFoldOperands() : MachineFunctionPass(ID) {
-    initializeSIFoldOperandsPass(*PassRegistry::getPassRegistry());
-  }
+  SIFoldOperandsImpl() = default;
+
+  bool run(MachineFunction &MF);
+};
 
-  bool runOnMachineFunction(MachineFunction &MF) override;
+class SIFoldOperandsLegacy : public MachineFunctionPass {
+public:
+  static char ID;
+
+  SIFoldOperandsLegacy() : MachineFunctionPass(ID) {}
+
+  bool runOnMachineFunction(MachineFunction &MF) override {
+    if (skipFunction(MF.getFunction()))
+      return false;
+    SIFoldOperandsImpl Impl;
+    return Impl.run(MF);
----------------
cdevadas wrote:

```suggestion
    return SIFoldOperandsImpl().run(MF);
```

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


More information about the llvm-commits mailing list