[llvm] [AMDGPU] Remove dead pass: AMDGPUMachineCFGStructurizer (PR #105645)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 22 04:46:57 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-amdgpu

Author: Juan Manuel Martinez CaamaƱo (jmmartinez)

<details>
<summary>Changes</summary>

The two deleted functions in `SIInstrInfo` where only referenced in the deleted pass.

```cpp
  void convertNonUniformIfRegion(MachineBasicBlock *IfEntry,
                                 MachineBasicBlock *IfEnd) const;

  void convertNonUniformLoopRegion(MachineBasicBlock *LoopEntry,
                                   MachineBasicBlock *LoopEnd) const;
```

The only thing I'm not really sure about is the change in `SIInstructions.td`.

---

Patch is 116.55 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/105645.diff


13 Files Affected:

- (modified) llvm/lib/Target/AMDGPU/AMDGPU.h (-4) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPU.td (-3) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp (+1-3) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.h (-2) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp (-1) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h (-1) 
- (removed) llvm/lib/Target/AMDGPU/AMDGPUMachineCFGStructurizer.cpp (-2837) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp (+4-20) 
- (modified) llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h (-1) 
- (modified) llvm/lib/Target/AMDGPU/CMakeLists.txt (-1) 
- (modified) llvm/lib/Target/AMDGPU/SIInstrInfo.cpp (-69) 
- (modified) llvm/lib/Target/AMDGPU/SIInstrInfo.h (-6) 
- (modified) llvm/lib/Target/AMDGPU/SIInstructions.td (+5-7) 


``````````diff
diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.h b/llvm/lib/Target/AMDGPU/AMDGPU.h
index f5044f52f1648d..afb8f2d93f0f15 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPU.h
+++ b/llvm/lib/Target/AMDGPU/AMDGPU.h
@@ -57,7 +57,6 @@ FunctionPass *createAMDGPUImageIntrinsicOptimizerPass(const TargetMachine *);
 ModulePass *createAMDGPURemoveIncompatibleFunctionsPass(const TargetMachine *);
 FunctionPass *createAMDGPUCodeGenPreparePass();
 FunctionPass *createAMDGPULateCodeGenPrepareLegacyPass();
-FunctionPass *createAMDGPUMachineCFGStructurizerPass();
 FunctionPass *createAMDGPURewriteOutArgumentsPass();
 ModulePass *
 createAMDGPULowerModuleLDSLegacyPass(const AMDGPUTargetMachine *TM = nullptr);
@@ -92,9 +91,6 @@ class SILowerI1CopiesPass : public PassInfoMixin<SILowerI1CopiesPass> {
 
 void initializeAMDGPUDAGToDAGISelLegacyPass(PassRegistry &);
 
-void initializeAMDGPUMachineCFGStructurizerPass(PassRegistry&);
-extern char &AMDGPUMachineCFGStructurizerID;
-
 void initializeAMDGPUAlwaysInlinePass(PassRegistry&);
 
 Pass *createAMDGPUAnnotateKernelFeaturesPass();
diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.td b/llvm/lib/Target/AMDGPU/AMDGPU.td
index 7906e0ee9d7858..0df1a23de849b8 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPU.td
+++ b/llvm/lib/Target/AMDGPU/AMDGPU.td
@@ -2242,9 +2242,6 @@ def HasDefaultComponentBroadcast
 def HasDsSrc2Insts : Predicate<"!Subtarget->hasDsSrc2Insts()">,
   AssemblerPredicate<(all_of FeatureDsSrc2Insts)>;
 
-def EnableLateCFGStructurize : Predicate<
-  "EnableLateStructurizeCFG">;
-
 def EnableFlatScratch : Predicate<"Subtarget->enableFlatScratch()">;
 
 def DisableFlatScratch : Predicate<"!Subtarget->enableFlatScratch()">;
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp b/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
index 6a0134e07567a1..0daaf6b6576030 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
@@ -121,9 +121,7 @@ FunctionPass *llvm::createAMDGPUISelDag(TargetMachine &TM,
 
 AMDGPUDAGToDAGISel::AMDGPUDAGToDAGISel(TargetMachine &TM,
                                        CodeGenOptLevel OptLevel)
-    : SelectionDAGISel(TM, OptLevel) {
-  EnableLateStructurizeCFG = AMDGPUTargetMachine::EnableLateStructurizeCFG;
-}
+    : SelectionDAGISel(TM, OptLevel) {}
 
 bool AMDGPUDAGToDAGISel::runOnMachineFunction(MachineFunction &MF) {
   Subtarget = &MF.getSubtarget<GCNSubtarget>();
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.h b/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.h
index 45a951352c1eb1..11c4cdd560c2f3 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.h
+++ b/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.h
@@ -68,8 +68,6 @@ class AMDGPUDAGToDAGISel : public SelectionDAGISel {
   // Default FP mode for the current function.
   SIModeRegisterDefaults Mode;
 
-  bool EnableLateStructurizeCFG;
-
   // Instructions that will be lowered with a final instruction that zeros the
   // high result bits.
   bool fp16SrcZerosHighBits(unsigned Opc) const;
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
index 05ed1b322c0d1b..17071970ca4bfe 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
@@ -45,7 +45,6 @@ AMDGPUInstructionSelector::AMDGPUInstructionSelector(
     const AMDGPUTargetMachine &TM)
     : TII(*STI.getInstrInfo()), TRI(*STI.getRegisterInfo()), RBI(RBI), TM(TM),
       STI(STI),
-      EnableLateStructurizeCFG(AMDGPUTargetMachine::EnableLateStructurizeCFG),
 #define GET_GLOBALISEL_PREDICATES_INIT
 #include "AMDGPUGenGlobalISel.inc"
 #undef GET_GLOBALISEL_PREDICATES_INIT
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h
index 69806b240cf2bc..207cd67f0eda0e 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h
+++ b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.h
@@ -371,7 +371,6 @@ class AMDGPUInstructionSelector final : public InstructionSelector {
   const AMDGPURegisterBankInfo &RBI;
   const AMDGPUTargetMachine &TM;
   const GCNSubtarget &STI;
-  bool EnableLateStructurizeCFG;
 #define GET_GLOBALISEL_PREDICATES_DECL
 #define AMDGPUSubtarget GCNSubtarget
 #include "AMDGPUGenGlobalISel.inc"
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUMachineCFGStructurizer.cpp b/llvm/lib/Target/AMDGPU/AMDGPUMachineCFGStructurizer.cpp
deleted file mode 100644
index 07b2ecc2fed0e9..00000000000000
--- a/llvm/lib/Target/AMDGPU/AMDGPUMachineCFGStructurizer.cpp
+++ /dev/null
@@ -1,2837 +0,0 @@
-//===- AMDGPUMachineCFGStructurizer.cpp - Machine code if conversion pass. ===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the machine instruction level CFG structurizer pass.
-//
-//===----------------------------------------------------------------------===//
-
-#include "AMDGPU.h"
-#include "GCNSubtarget.h"
-#include "llvm/ADT/DenseSet.h"
-#include "llvm/ADT/PostOrderIterator.h"
-#include "llvm/ADT/SetVector.h"
-#include "llvm/ADT/SmallPtrSet.h"
-#include "llvm/CodeGen/MachineBasicBlock.h"
-#include "llvm/CodeGen/MachineInstrBuilder.h"
-#include "llvm/CodeGen/MachineRegionInfo.h"
-#include "llvm/CodeGen/MachineRegisterInfo.h"
-#include "llvm/CodeGen/TargetRegisterInfo.h"
-#include "llvm/InitializePasses.h"
-
-using namespace llvm;
-
-#define DEBUG_TYPE "amdgpucfgstructurizer"
-
-namespace {
-
-class PHILinearizeDestIterator;
-
-class PHILinearize {
-  friend class PHILinearizeDestIterator;
-
-public:
-  using PHISourceT = std::pair<unsigned, MachineBasicBlock *>;
-
-private:
-  using PHISourcesT = DenseSet<PHISourceT>;
-  using PHIInfoElementT = struct {
-    unsigned DestReg;
-    DebugLoc DL;
-    PHISourcesT Sources;
-  };
-  using PHIInfoT = SmallPtrSet<PHIInfoElementT *, 2>;
-  PHIInfoT PHIInfo;
-
-  static unsigned phiInfoElementGetDest(PHIInfoElementT *Info);
-  static void phiInfoElementSetDef(PHIInfoElementT *Info, unsigned NewDef);
-  static PHISourcesT &phiInfoElementGetSources(PHIInfoElementT *Info);
-  static void phiInfoElementAddSource(PHIInfoElementT *Info, unsigned SourceReg,
-                                      MachineBasicBlock *SourceMBB);
-  static void phiInfoElementRemoveSource(PHIInfoElementT *Info,
-                                         unsigned SourceReg,
-                                         MachineBasicBlock *SourceMBB);
-  PHIInfoElementT *findPHIInfoElement(unsigned DestReg);
-  PHIInfoElementT *findPHIInfoElementFromSource(unsigned SourceReg,
-                                                MachineBasicBlock *SourceMBB);
-
-public:
-  bool findSourcesFromMBB(MachineBasicBlock *SourceMBB,
-                          SmallVector<unsigned, 4> &Sources);
-  void addDest(unsigned DestReg, const DebugLoc &DL);
-  void replaceDef(unsigned OldDestReg, unsigned NewDestReg);
-  void deleteDef(unsigned DestReg);
-  void addSource(unsigned DestReg, unsigned SourceReg,
-                 MachineBasicBlock *SourceMBB);
-  void removeSource(unsigned DestReg, unsigned SourceReg,
-                    MachineBasicBlock *SourceMBB = nullptr);
-  bool findDest(unsigned SourceReg, MachineBasicBlock *SourceMBB,
-                unsigned &DestReg);
-  bool isSource(unsigned Reg, MachineBasicBlock *SourceMBB = nullptr);
-  unsigned getNumSources(unsigned DestReg);
-  void dump(MachineRegisterInfo *MRI);
-  void clear();
-
-  using source_iterator = PHISourcesT::iterator;
-  using dest_iterator = PHILinearizeDestIterator;
-
-  dest_iterator dests_begin();
-  dest_iterator dests_end();
-
-  source_iterator sources_begin(unsigned Reg);
-  source_iterator sources_end(unsigned Reg);
-};
-
-class PHILinearizeDestIterator {
-private:
-  PHILinearize::PHIInfoT::iterator Iter;
-
-public:
-  PHILinearizeDestIterator(PHILinearize::PHIInfoT::iterator I) : Iter(I) {}
-
-  unsigned operator*() { return PHILinearize::phiInfoElementGetDest(*Iter); }
-  PHILinearizeDestIterator &operator++() {
-    ++Iter;
-    return *this;
-  }
-  bool operator==(const PHILinearizeDestIterator &I) const {
-    return I.Iter == Iter;
-  }
-  bool operator!=(const PHILinearizeDestIterator &I) const {
-    return I.Iter != Iter;
-  }
-};
-
-} // end anonymous namespace
-
-unsigned PHILinearize::phiInfoElementGetDest(PHIInfoElementT *Info) {
-  return Info->DestReg;
-}
-
-void PHILinearize::phiInfoElementSetDef(PHIInfoElementT *Info,
-                                        unsigned NewDef) {
-  Info->DestReg = NewDef;
-}
-
-PHILinearize::PHISourcesT &
-PHILinearize::phiInfoElementGetSources(PHIInfoElementT *Info) {
-  return Info->Sources;
-}
-
-void PHILinearize::phiInfoElementAddSource(PHIInfoElementT *Info,
-                                           unsigned SourceReg,
-                                           MachineBasicBlock *SourceMBB) {
-  // Assertion ensures we don't use the same SourceMBB for the
-  // sources, because we cannot have different registers with
-  // identical predecessors, but we can have the same register for
-  // multiple predecessors.
-#if !defined(NDEBUG)
-  for (auto SI : phiInfoElementGetSources(Info)) {
-    assert((SI.second != SourceMBB || SourceReg == SI.first));
-  }
-#endif
-
-  phiInfoElementGetSources(Info).insert(PHISourceT(SourceReg, SourceMBB));
-}
-
-void PHILinearize::phiInfoElementRemoveSource(PHIInfoElementT *Info,
-                                              unsigned SourceReg,
-                                              MachineBasicBlock *SourceMBB) {
-  auto &Sources = phiInfoElementGetSources(Info);
-  SmallVector<PHISourceT, 4> ElimiatedSources;
-  for (auto SI : Sources) {
-    if (SI.first == SourceReg &&
-        (SI.second == nullptr || SI.second == SourceMBB)) {
-      ElimiatedSources.push_back(PHISourceT(SI.first, SI.second));
-    }
-  }
-
-  for (auto &Source : ElimiatedSources) {
-    Sources.erase(Source);
-  }
-}
-
-PHILinearize::PHIInfoElementT *
-PHILinearize::findPHIInfoElement(unsigned DestReg) {
-  for (auto *I : PHIInfo) {
-    if (phiInfoElementGetDest(I) == DestReg) {
-      return I;
-    }
-  }
-  return nullptr;
-}
-
-PHILinearize::PHIInfoElementT *
-PHILinearize::findPHIInfoElementFromSource(unsigned SourceReg,
-                                           MachineBasicBlock *SourceMBB) {
-  for (auto *I : PHIInfo) {
-    for (auto SI : phiInfoElementGetSources(I)) {
-      if (SI.first == SourceReg &&
-          (SI.second == nullptr || SI.second == SourceMBB)) {
-        return I;
-      }
-    }
-  }
-  return nullptr;
-}
-
-bool PHILinearize::findSourcesFromMBB(MachineBasicBlock *SourceMBB,
-                                      SmallVector<unsigned, 4> &Sources) {
-  bool FoundSource = false;
-  for (auto *I : PHIInfo) {
-    for (auto SI : phiInfoElementGetSources(I)) {
-      if (SI.second == SourceMBB) {
-        FoundSource = true;
-        Sources.push_back(SI.first);
-      }
-    }
-  }
-  return FoundSource;
-}
-
-void PHILinearize::addDest(unsigned DestReg, const DebugLoc &DL) {
-  assert(findPHIInfoElement(DestReg) == nullptr && "Dest already exists");
-  PHISourcesT EmptySet;
-  PHIInfoElementT *NewElement = new PHIInfoElementT();
-  NewElement->DestReg = DestReg;
-  NewElement->DL = DL;
-  NewElement->Sources = EmptySet;
-  PHIInfo.insert(NewElement);
-}
-
-void PHILinearize::replaceDef(unsigned OldDestReg, unsigned NewDestReg) {
-  phiInfoElementSetDef(findPHIInfoElement(OldDestReg), NewDestReg);
-}
-
-void PHILinearize::deleteDef(unsigned DestReg) {
-  PHIInfoElementT *InfoElement = findPHIInfoElement(DestReg);
-  PHIInfo.erase(InfoElement);
-  delete InfoElement;
-}
-
-void PHILinearize::addSource(unsigned DestReg, unsigned SourceReg,
-                             MachineBasicBlock *SourceMBB) {
-  phiInfoElementAddSource(findPHIInfoElement(DestReg), SourceReg, SourceMBB);
-}
-
-void PHILinearize::removeSource(unsigned DestReg, unsigned SourceReg,
-                                MachineBasicBlock *SourceMBB) {
-  phiInfoElementRemoveSource(findPHIInfoElement(DestReg), SourceReg, SourceMBB);
-}
-
-bool PHILinearize::findDest(unsigned SourceReg, MachineBasicBlock *SourceMBB,
-                            unsigned &DestReg) {
-  PHIInfoElementT *InfoElement =
-      findPHIInfoElementFromSource(SourceReg, SourceMBB);
-  if (InfoElement != nullptr) {
-    DestReg = phiInfoElementGetDest(InfoElement);
-    return true;
-  }
-  return false;
-}
-
-bool PHILinearize::isSource(unsigned Reg, MachineBasicBlock *SourceMBB) {
-  unsigned DestReg;
-  return findDest(Reg, SourceMBB, DestReg);
-}
-
-unsigned PHILinearize::getNumSources(unsigned DestReg) {
-  return phiInfoElementGetSources(findPHIInfoElement(DestReg)).size();
-}
-
-#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-LLVM_DUMP_METHOD void PHILinearize::dump(MachineRegisterInfo *MRI) {
-  const TargetRegisterInfo *TRI = MRI->getTargetRegisterInfo();
-  dbgs() << "=PHIInfo Start=\n";
-  for (auto *PII : this->PHIInfo) {
-    PHIInfoElementT &Element = *PII;
-    dbgs() << "Dest: " << printReg(Element.DestReg, TRI)
-           << " Sources: {";
-    for (auto &SI : Element.Sources) {
-      dbgs() << printReg(SI.first, TRI) << '(' << printMBBReference(*SI.second)
-             << "),";
-    }
-    dbgs() << "}\n";
-  }
-  dbgs() << "=PHIInfo End=\n";
-}
-#endif
-
-void PHILinearize::clear() { PHIInfo = PHIInfoT(); }
-
-PHILinearize::dest_iterator PHILinearize::dests_begin() {
-  return PHILinearizeDestIterator(PHIInfo.begin());
-}
-
-PHILinearize::dest_iterator PHILinearize::dests_end() {
-  return PHILinearizeDestIterator(PHIInfo.end());
-}
-
-PHILinearize::source_iterator PHILinearize::sources_begin(unsigned Reg) {
-  auto InfoElement = findPHIInfoElement(Reg);
-  return phiInfoElementGetSources(InfoElement).begin();
-}
-
-PHILinearize::source_iterator PHILinearize::sources_end(unsigned Reg) {
-  auto InfoElement = findPHIInfoElement(Reg);
-  return phiInfoElementGetSources(InfoElement).end();
-}
-
-static unsigned getPHINumInputs(MachineInstr &PHI) {
-  assert(PHI.isPHI());
-  return (PHI.getNumOperands() - 1) / 2;
-}
-
-static MachineBasicBlock *getPHIPred(MachineInstr &PHI, unsigned Index) {
-  assert(PHI.isPHI());
-  return PHI.getOperand(Index * 2 + 2).getMBB();
-}
-
-static void setPhiPred(MachineInstr &PHI, unsigned Index,
-                       MachineBasicBlock *NewPred) {
-  PHI.getOperand(Index * 2 + 2).setMBB(NewPred);
-}
-
-static unsigned getPHISourceReg(MachineInstr &PHI, unsigned Index) {
-  assert(PHI.isPHI());
-  return PHI.getOperand(Index * 2 + 1).getReg();
-}
-
-static unsigned getPHIDestReg(MachineInstr &PHI) {
-  assert(PHI.isPHI());
-  return PHI.getOperand(0).getReg();
-}
-
-namespace {
-
-class RegionMRT;
-class MBBMRT;
-
-class LinearizedRegion {
-protected:
-  MachineBasicBlock *Entry;
-  // The exit block is part of the region, and is the last
-  // merge block before exiting the region.
-  MachineBasicBlock *Exit;
-  DenseSet<unsigned> LiveOuts;
-  SmallPtrSet<MachineBasicBlock *, 1> MBBs;
-  bool HasLoop;
-  LinearizedRegion *Parent;
-  RegionMRT *RMRT;
-
-  void storeLiveOutReg(MachineBasicBlock *MBB, Register Reg,
-                       MachineInstr *DefInstr, const MachineRegisterInfo *MRI,
-                       const TargetRegisterInfo *TRI, PHILinearize &PHIInfo);
-
-  void storeLiveOutRegRegion(RegionMRT *Region, Register Reg,
-                             MachineInstr *DefInstr,
-                             const MachineRegisterInfo *MRI,
-                             const TargetRegisterInfo *TRI,
-                             PHILinearize &PHIInfo);
-
-  void storeMBBLiveOuts(MachineBasicBlock *MBB, const MachineRegisterInfo *MRI,
-                        const TargetRegisterInfo *TRI, PHILinearize &PHIInfo,
-                        RegionMRT *TopRegion);
-
-  void storeLiveOuts(MachineBasicBlock *MBB, const MachineRegisterInfo *MRI,
-                     const TargetRegisterInfo *TRI, PHILinearize &PHIInfo);
-
-  void storeLiveOuts(RegionMRT *Region, const MachineRegisterInfo *MRI,
-                     const TargetRegisterInfo *TRI, PHILinearize &PHIInfo,
-                     RegionMRT *TopRegion = nullptr);
-
-public:
-  LinearizedRegion();
-  LinearizedRegion(MachineBasicBlock *MBB, const MachineRegisterInfo *MRI,
-                   const TargetRegisterInfo *TRI, PHILinearize &PHIInfo);
-  ~LinearizedRegion() = default;
-
-  void setRegionMRT(RegionMRT *Region) { RMRT = Region; }
-
-  RegionMRT *getRegionMRT() { return RMRT; }
-
-  void setParent(LinearizedRegion *P) { Parent = P; }
-
-  LinearizedRegion *getParent() { return Parent; }
-
-  void print(raw_ostream &OS, const TargetRegisterInfo *TRI = nullptr);
-
-  void setBBSelectRegIn(unsigned Reg);
-
-  unsigned getBBSelectRegIn();
-
-  void setBBSelectRegOut(unsigned Reg, bool IsLiveOut);
-
-  unsigned getBBSelectRegOut();
-
-  void setHasLoop(bool Value);
-
-  bool getHasLoop();
-
-  void addLiveOut(unsigned VReg);
-
-  void removeLiveOut(unsigned Reg);
-
-  void replaceLiveOut(unsigned OldReg, unsigned NewReg);
-
-  void replaceRegister(unsigned Register, class Register NewRegister,
-                       MachineRegisterInfo *MRI, bool ReplaceInside,
-                       bool ReplaceOutside, bool IncludeLoopPHIs);
-
-  void replaceRegisterInsideRegion(unsigned Register, unsigned NewRegister,
-                                   bool IncludeLoopPHIs,
-                                   MachineRegisterInfo *MRI);
-
-  void replaceRegisterOutsideRegion(unsigned Register, unsigned NewRegister,
-                                    bool IncludeLoopPHIs,
-                                    MachineRegisterInfo *MRI);
-
-  DenseSet<unsigned> *getLiveOuts();
-
-  void setEntry(MachineBasicBlock *NewEntry);
-
-  MachineBasicBlock *getEntry();
-
-  void setExit(MachineBasicBlock *NewExit);
-
-  MachineBasicBlock *getExit();
-
-  void addMBB(MachineBasicBlock *MBB);
-
-  void addMBBs(LinearizedRegion *InnerRegion);
-
-  bool contains(MachineBasicBlock *MBB);
-
-  bool isLiveOut(unsigned Reg);
-
-  bool hasNoDef(unsigned Reg, MachineRegisterInfo *MRI);
-
-  void removeFalseRegisterKills(MachineRegisterInfo *MRI);
-
-  void initLiveOut(RegionMRT *Region, const MachineRegisterInfo *MRI,
-                   const TargetRegisterInfo *TRI, PHILinearize &PHIInfo);
-};
-
-class MRT {
-protected:
-  RegionMRT *Parent;
-  unsigned BBSelectRegIn;
-  unsigned BBSelectRegOut;
-
-public:
-  virtual ~MRT() = default;
-
-  unsigned getBBSelectRegIn() { return BBSelectRegIn; }
-
-  unsigned getBBSelectRegOut() { return BBSelectRegOut; }
-
-  void setBBSelectRegIn(unsigned Reg) { BBSelectRegIn = Reg; }
-
-  void setBBSelectRegOut(unsigned Reg) { BBSelectRegOut = Reg; }
-
-  virtual RegionMRT *getRegionMRT() { return nullptr; }
-
-  virtual MBBMRT *getMBBMRT() { return nullptr; }
-
-  bool isRegion() { return getRegionMRT() != nullptr; }
-
-  bool isMBB() { return getMBBMRT() != nullptr; }
-
-  bool isRoot() { return Parent == nullptr; }
-
-  void setParent(RegionMRT *Region) { Parent = Region; }
-
-  RegionMRT *getParent() { return Parent; }
-
-  static MachineBasicBlock *
-  initializeMRT(MachineFunction &MF, const MachineRegionInfo *RegionInfo,
-                DenseMap<MachineRegion *, RegionMRT *> &RegionMap);
-
-  static RegionMRT *buildMRT(MachineFunction &MF,
-                             const MachineRegionInfo *RegionInfo,
-                             const SIInstrInfo *TII,
-                             MachineRegisterInfo *MRI);
-
-  virtual void dump(const TargetRegisterInfo *TRI, int depth = 0) = 0;
-
-  void dumpDepth(int depth) {
-    for (int i = depth; i > 0; --i) {
-      dbgs() << "  ";
-    }
-  }
-};
-
-class MBBMRT : public MRT {
-  MachineBasicBlock *MBB;
-
-public:
-  MBBMRT(MachineBasicBlock *BB) : MBB(BB) {
-    setParent(nullptr);
-    setBBSelectRegOut(0);
-    setBBSelectRegIn(0);
-  }
-
-  MBBMRT *getMBBMRT() override { return this; }
-
-  MachineBasicBlock *getMBB() { return MBB; }
-
-  void dump(const TargetRegisterInfo *TRI, int depth = 0) override {
-    dumpDepth(depth);
-    dbgs() << "MBB: " << getMBB()->getNumber();
-    dbgs() << " In: " << printReg(getBBSelectRegIn(), TRI);
-    dbgs() << ", Out: " << printReg(getBBSelectRegOut(), TRI) << "\n";
-  }
-};
-
-class RegionMRT ...
[truncated]

``````````

</details>


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


More information about the llvm-commits mailing list