[llvm] [MachineLICM] Remove dead flag PreRegAlloc (PR #107222)

Akshat Oke via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 4 04:20:11 PDT 2024


https://github.com/Akshat-Oke created https://github.com/llvm/llvm-project/pull/107222

None

>From bff50569308b24cccd01a8899e14d34a2642dcdd Mon Sep 17 00:00:00 2001
From: Akshat Oke <Akshat.Oke at amd.com>
Date: Wed, 4 Sep 2024 10:41:06 +0000
Subject: [PATCH] [MachineLICM] Remove dead flag PreRegAlloc

---
 llvm/lib/CodeGen/MachineLICM.cpp | 29 ++++++++---------------------
 1 file changed, 8 insertions(+), 21 deletions(-)

diff --git a/llvm/lib/CodeGen/MachineLICM.cpp b/llvm/lib/CodeGen/MachineLICM.cpp
index 1e4bf4bba56220..003fee969515bb 100644
--- a/llvm/lib/CodeGen/MachineLICM.cpp
+++ b/llvm/lib/CodeGen/MachineLICM.cpp
@@ -182,8 +182,9 @@ namespace {
     unsigned SpeculationState = SpeculateUnknown;
 
   public:
-    MachineLICMBase(char &PassID, bool PreRegAlloc)
-        : MachineFunctionPass(PassID), PreRegAlloc(PreRegAlloc) {}
+  static char ID;
+    MachineLICMBase()
+        : MachineFunctionPass(ID) {}
 
     bool runOnMachineFunction(MachineFunction &MF) override;
 
@@ -297,29 +298,15 @@ namespace {
                                        MachineBasicBlock *CurPreheader);
   };
 
-  class MachineLICM : public MachineLICMBase {
-  public:
-    static char ID;
-    MachineLICM() : MachineLICMBase(ID, false) {
-      initializeMachineLICMPass(*PassRegistry::getPassRegistry());
-    }
-  };
-
-  class EarlyMachineLICM : public MachineLICMBase {
-  public:
-    static char ID;
-    EarlyMachineLICM() : MachineLICMBase(ID, true) {
-      initializeEarlyMachineLICMPass(*PassRegistry::getPassRegistry());
-    }
-  };
+  using MachineLICM = MachineLICMBase;
+  using EarlyMachineLICM = MachineLICMBase;
 
 } // end anonymous namespace
 
-char MachineLICM::ID;
-char EarlyMachineLICM::ID;
+char MachineLICMBase::ID;
 
-char &llvm::MachineLICMID = MachineLICM::ID;
-char &llvm::EarlyMachineLICMID = EarlyMachineLICM::ID;
+char &llvm::MachineLICMID = MachineLICMBase::ID;
+char &llvm::EarlyMachineLICMID = MachineLICMBase::ID;
 
 INITIALIZE_PASS_BEGIN(MachineLICM, DEBUG_TYPE,
                       "Machine Loop Invariant Code Motion", false, false)



More information about the llvm-commits mailing list