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

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


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

>From 3d7048e011fe926cb67b912aacbb42265f62e7a2 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 | 28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)

diff --git a/llvm/lib/CodeGen/MachineLICM.cpp b/llvm/lib/CodeGen/MachineLICM.cpp
index 1e4bf4bba56220..2ba0fc899fadc1 100644
--- a/llvm/lib/CodeGen/MachineLICM.cpp
+++ b/llvm/lib/CodeGen/MachineLICM.cpp
@@ -182,8 +182,8 @@ 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 +297,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