[llvm] [NFC][CodeGen] Clang format MachineSink.cpp (PR #114027)

Akshat Oke via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 7 23:20:12 PST 2024


https://github.com/optimisan updated https://github.com/llvm/llvm-project/pull/114027

>From aeb7c6079ad639733365fbc2bc4b585e80d199c3 Mon Sep 17 00:00:00 2001
From: Akshat Oke <Akshat.Oke at amd.com>
Date: Tue, 29 Oct 2024 10:12:42 +0000
Subject: [PATCH] [NFC][CodeGen] Clang format MachineSink.cpp

---
 llvm/lib/CodeGen/MachineSink.cpp | 405 ++++++++++++++++---------------
 1 file changed, 206 insertions(+), 199 deletions(-)

diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp
index 658ebd47488c71..a0e09398602e9e 100644
--- a/llvm/lib/CodeGen/MachineSink.cpp
+++ b/llvm/lib/CodeGen/MachineSink.cpp
@@ -65,14 +65,14 @@ using namespace llvm;
 #define DEBUG_TYPE "machine-sink"
 
 static cl::opt<bool>
-SplitEdges("machine-sink-split",
-           cl::desc("Split critical edges during machine sinking"),
-           cl::init(true), cl::Hidden);
+    SplitEdges("machine-sink-split",
+               cl::desc("Split critical edges during machine sinking"),
+               cl::init(true), cl::Hidden);
 
-static cl::opt<bool>
-UseBlockFreqInfo("machine-sink-bfi",
-           cl::desc("Use block frequency info to find successors to sink"),
-           cl::init(true), cl::Hidden);
+static cl::opt<bool> UseBlockFreqInfo(
+    "machine-sink-bfi",
+    cl::desc("Use block frequency info to find successors to sink"),
+    cl::init(true), cl::Hidden);
 
 static cl::opt<unsigned> SplitEdgeProbabilityThreshold(
     "machine-sink-split-probability-threshold",
@@ -103,178 +103,178 @@ static cl::opt<bool>
 
 static cl::opt<unsigned> SinkIntoCycleLimit(
     "machine-sink-cycle-limit",
-    cl::desc("The maximum number of instructions considered for cycle sinking."),
+    cl::desc(
+        "The maximum number of instructions considered for cycle sinking."),
     cl::init(50), cl::Hidden);
 
-STATISTIC(NumSunk,      "Number of machine instructions sunk");
-STATISTIC(NumCycleSunk,  "Number of machine instructions sunk into a cycle");
-STATISTIC(NumSplit,     "Number of critical edges split");
+STATISTIC(NumSunk, "Number of machine instructions sunk");
+STATISTIC(NumCycleSunk, "Number of machine instructions sunk into a cycle");
+STATISTIC(NumSplit, "Number of critical edges split");
 STATISTIC(NumCoalesces, "Number of copies coalesced");
 STATISTIC(NumPostRACopySink, "Number of copies sunk after RA");
 
 namespace {
 
-  class MachineSinking : public MachineFunctionPass {
-    const TargetSubtargetInfo *STI = nullptr;
-    const TargetInstrInfo *TII = nullptr;
-    const TargetRegisterInfo *TRI = nullptr;
-    MachineRegisterInfo *MRI = nullptr;      // Machine register information
-    MachineDominatorTree *DT = nullptr;      // Machine dominator tree
-    MachinePostDominatorTree *PDT = nullptr; // Machine post dominator tree
-    MachineCycleInfo *CI = nullptr;
-    MachineBlockFrequencyInfo *MBFI = nullptr;
-    const MachineBranchProbabilityInfo *MBPI = nullptr;
-    AliasAnalysis *AA = nullptr;
-    RegisterClassInfo RegClassInfo;
-
-    // Remember which edges have been considered for breaking.
-    SmallSet<std::pair<MachineBasicBlock*, MachineBasicBlock*>, 8>
-    CEBCandidates;
-    // Memorize the register that also wanted to sink into the same block along
-    // a different critical edge.
-    // {register to sink, sink-to block} -> the first sink-from block.
-    // We're recording the first sink-from block because that (critical) edge
-    // was deferred until we see another register that's going to sink into the
-    // same block.
-    DenseMap<std::pair<Register, MachineBasicBlock *>, MachineBasicBlock *>
-        CEMergeCandidates;
-    // Remember which edges we are about to split.
-    // This is different from CEBCandidates since those edges
-    // will be split.
-    SetVector<std::pair<MachineBasicBlock *, MachineBasicBlock *>> ToSplit;
-
-    DenseSet<Register> RegsToClearKillFlags;
-
-    using AllSuccsCache =
-        SmallDenseMap<MachineBasicBlock *, SmallVector<MachineBasicBlock *, 4>>;
-
-    /// DBG_VALUE pointer and flag. The flag is true if this DBG_VALUE is
-    /// post-dominated by another DBG_VALUE of the same variable location.
-    /// This is necessary to detect sequences such as:
-    ///     %0 = someinst
-    ///     DBG_VALUE %0, !123, !DIExpression()
-    ///     %1 = anotherinst
-    ///     DBG_VALUE %1, !123, !DIExpression()
-    /// Where if %0 were to sink, the DBG_VAUE should not sink with it, as that
-    /// would re-order assignments.
-    using SeenDbgUser = PointerIntPair<MachineInstr *, 1>;
-
-    /// Record of DBG_VALUE uses of vregs in a block, so that we can identify
-    /// debug instructions to sink.
-    SmallDenseMap<unsigned, TinyPtrVector<SeenDbgUser>> SeenDbgUsers;
-
-    /// Record of debug variables that have had their locations set in the
-    /// current block.
-    DenseSet<DebugVariable> SeenDbgVars;
-
-    DenseMap<std::pair<MachineBasicBlock *, MachineBasicBlock *>, bool>
-        HasStoreCache;
-
-    DenseMap<std::pair<MachineBasicBlock *, MachineBasicBlock *>,
-             SmallVector<MachineInstr *>>
-        StoreInstrCache;
-
-    /// Cached BB's register pressure.
-    DenseMap<const MachineBasicBlock *, std::vector<unsigned>>
-        CachedRegisterPressure;
-
-    bool EnableSinkAndFold;
-
-  public:
-    static char ID; // Pass identification
-
-    MachineSinking() : MachineFunctionPass(ID) {
-      initializeMachineSinkingPass(*PassRegistry::getPassRegistry());
-    }
+class MachineSinking : public MachineFunctionPass {
+  const TargetSubtargetInfo *STI = nullptr;
+  const TargetInstrInfo *TII = nullptr;
+  const TargetRegisterInfo *TRI = nullptr;
+  MachineRegisterInfo *MRI = nullptr;      // Machine register information
+  MachineDominatorTree *DT = nullptr;      // Machine dominator tree
+  MachinePostDominatorTree *PDT = nullptr; // Machine post dominator tree
+  MachineCycleInfo *CI = nullptr;
+  MachineBlockFrequencyInfo *MBFI = nullptr;
+  const MachineBranchProbabilityInfo *MBPI = nullptr;
+  AliasAnalysis *AA = nullptr;
+  RegisterClassInfo RegClassInfo;
+
+  // Remember which edges have been considered for breaking.
+  SmallSet<std::pair<MachineBasicBlock *, MachineBasicBlock *>, 8>
+      CEBCandidates;
+  // Memorize the register that also wanted to sink into the same block along
+  // a different critical edge.
+  // {register to sink, sink-to block} -> the first sink-from block.
+  // We're recording the first sink-from block because that (critical) edge
+  // was deferred until we see another register that's going to sink into the
+  // same block.
+  DenseMap<std::pair<Register, MachineBasicBlock *>, MachineBasicBlock *>
+      CEMergeCandidates;
+  // Remember which edges we are about to split.
+  // This is different from CEBCandidates since those edges
+  // will be split.
+  SetVector<std::pair<MachineBasicBlock *, MachineBasicBlock *>> ToSplit;
+
+  DenseSet<Register> RegsToClearKillFlags;
+
+  using AllSuccsCache =
+      SmallDenseMap<MachineBasicBlock *, SmallVector<MachineBasicBlock *, 4>>;
+
+  /// DBG_VALUE pointer and flag. The flag is true if this DBG_VALUE is
+  /// post-dominated by another DBG_VALUE of the same variable location.
+  /// This is necessary to detect sequences such as:
+  ///     %0 = someinst
+  ///     DBG_VALUE %0, !123, !DIExpression()
+  ///     %1 = anotherinst
+  ///     DBG_VALUE %1, !123, !DIExpression()
+  /// Where if %0 were to sink, the DBG_VAUE should not sink with it, as that
+  /// would re-order assignments.
+  using SeenDbgUser = PointerIntPair<MachineInstr *, 1>;
+
+  /// Record of DBG_VALUE uses of vregs in a block, so that we can identify
+  /// debug instructions to sink.
+  SmallDenseMap<unsigned, TinyPtrVector<SeenDbgUser>> SeenDbgUsers;
+
+  /// Record of debug variables that have had their locations set in the
+  /// current block.
+  DenseSet<DebugVariable> SeenDbgVars;
+
+  DenseMap<std::pair<MachineBasicBlock *, MachineBasicBlock *>, bool>
+      HasStoreCache;
+
+  DenseMap<std::pair<MachineBasicBlock *, MachineBasicBlock *>,
+           SmallVector<MachineInstr *>>
+      StoreInstrCache;
+
+  /// Cached BB's register pressure.
+  DenseMap<const MachineBasicBlock *, std::vector<unsigned>>
+      CachedRegisterPressure;
+
+  bool EnableSinkAndFold;
 
-    bool runOnMachineFunction(MachineFunction &MF) override;
-
-    void getAnalysisUsage(AnalysisUsage &AU) const override {
-      MachineFunctionPass::getAnalysisUsage(AU);
-      AU.addRequired<AAResultsWrapperPass>();
-      AU.addRequired<MachineDominatorTreeWrapperPass>();
-      AU.addRequired<MachinePostDominatorTreeWrapperPass>();
-      AU.addRequired<MachineCycleInfoWrapperPass>();
-      AU.addRequired<MachineBranchProbabilityInfoWrapperPass>();
-      AU.addPreserved<MachineCycleInfoWrapperPass>();
-      AU.addPreserved<MachineLoopInfoWrapperPass>();
-      if (UseBlockFreqInfo)
-        AU.addRequired<MachineBlockFrequencyInfoWrapperPass>();
-      AU.addRequired<TargetPassConfig>();
-    }
+public:
+  static char ID; // Pass identification
 
-    void releaseMemory() override {
-      CEBCandidates.clear();
-      CEMergeCandidates.clear();
-    }
+  MachineSinking() : MachineFunctionPass(ID) {
+    initializeMachineSinkingPass(*PassRegistry::getPassRegistry());
+  }
 
-  private:
-    bool ProcessBlock(MachineBasicBlock &MBB);
-    void ProcessDbgInst(MachineInstr &MI);
-    bool isLegalToBreakCriticalEdge(MachineInstr &MI, MachineBasicBlock *From,
-                                    MachineBasicBlock *To, bool BreakPHIEdge);
-    bool isWorthBreakingCriticalEdge(MachineInstr &MI, MachineBasicBlock *From,
-                                     MachineBasicBlock *To,
-                                     MachineBasicBlock *&DeferredFromBlock);
-
-    bool hasStoreBetween(MachineBasicBlock *From, MachineBasicBlock *To,
-                         MachineInstr &MI);
-
-    /// Postpone the splitting of the given critical
-    /// edge (\p From, \p To).
-    ///
-    /// We do not split the edges on the fly. Indeed, this invalidates
-    /// the dominance information and thus triggers a lot of updates
-    /// of that information underneath.
-    /// Instead, we postpone all the splits after each iteration of
-    /// the main loop. That way, the information is at least valid
-    /// for the lifetime of an iteration.
-    ///
-    /// \return True if the edge is marked as toSplit, false otherwise.
-    /// False can be returned if, for instance, this is not profitable.
-    bool PostponeSplitCriticalEdge(MachineInstr &MI,
-                                   MachineBasicBlock *From,
+  bool runOnMachineFunction(MachineFunction &MF) override;
+
+  void getAnalysisUsage(AnalysisUsage &AU) const override {
+    MachineFunctionPass::getAnalysisUsage(AU);
+    AU.addRequired<AAResultsWrapperPass>();
+    AU.addRequired<MachineDominatorTreeWrapperPass>();
+    AU.addRequired<MachinePostDominatorTreeWrapperPass>();
+    AU.addRequired<MachineCycleInfoWrapperPass>();
+    AU.addRequired<MachineBranchProbabilityInfoWrapperPass>();
+    AU.addPreserved<MachineCycleInfoWrapperPass>();
+    AU.addPreserved<MachineLoopInfoWrapperPass>();
+    if (UseBlockFreqInfo)
+      AU.addRequired<MachineBlockFrequencyInfoWrapperPass>();
+    AU.addRequired<TargetPassConfig>();
+  }
+
+  void releaseMemory() override {
+    CEBCandidates.clear();
+    CEMergeCandidates.clear();
+  }
+
+private:
+  bool ProcessBlock(MachineBasicBlock &MBB);
+  void ProcessDbgInst(MachineInstr &MI);
+  bool isLegalToBreakCriticalEdge(MachineInstr &MI, MachineBasicBlock *From,
+                                  MachineBasicBlock *To, bool BreakPHIEdge);
+  bool isWorthBreakingCriticalEdge(MachineInstr &MI, MachineBasicBlock *From,
                                    MachineBasicBlock *To,
-                                   bool BreakPHIEdge);
-    bool SinkInstruction(MachineInstr &MI, bool &SawStore,
-                         AllSuccsCache &AllSuccessors);
-
-    /// If we sink a COPY inst, some debug users of it's destination may no
-    /// longer be dominated by the COPY, and will eventually be dropped.
-    /// This is easily rectified by forwarding the non-dominated debug uses
-    /// to the copy source.
-    void SalvageUnsunkDebugUsersOfCopy(MachineInstr &,
-                                       MachineBasicBlock *TargetBlock);
-    bool AllUsesDominatedByBlock(Register Reg, MachineBasicBlock *MBB,
-                                 MachineBasicBlock *DefMBB, bool &BreakPHIEdge,
-                                 bool &LocalUse) const;
-    MachineBasicBlock *FindSuccToSinkTo(MachineInstr &MI, MachineBasicBlock *MBB,
-               bool &BreakPHIEdge, AllSuccsCache &AllSuccessors);
-
-    void FindCycleSinkCandidates(MachineCycle *Cycle, MachineBasicBlock *BB,
-                                 SmallVectorImpl<MachineInstr *> &Candidates);
-    bool SinkIntoCycle(MachineCycle *Cycle, MachineInstr &I);
-
-    bool isProfitableToSinkTo(Register Reg, MachineInstr &MI,
-                              MachineBasicBlock *MBB,
-                              MachineBasicBlock *SuccToSinkTo,
-                              AllSuccsCache &AllSuccessors);
-
-    bool PerformTrivialForwardCoalescing(MachineInstr &MI,
-                                         MachineBasicBlock *MBB);
-
-    bool PerformSinkAndFold(MachineInstr &MI, MachineBasicBlock *MBB);
-
-    SmallVector<MachineBasicBlock *, 4> &
-    GetAllSortedSuccessors(MachineInstr &MI, MachineBasicBlock *MBB,
-                           AllSuccsCache &AllSuccessors) const;
-
-    std::vector<unsigned> &getBBRegisterPressure(const MachineBasicBlock &MBB);
-
-    bool registerPressureSetExceedsLimit(unsigned NRegs,
-                                         const TargetRegisterClass *RC,
-                                         const MachineBasicBlock &MBB);
-  };
+                                   MachineBasicBlock *&DeferredFromBlock);
+
+  bool hasStoreBetween(MachineBasicBlock *From, MachineBasicBlock *To,
+                       MachineInstr &MI);
+
+  /// Postpone the splitting of the given critical
+  /// edge (\p From, \p To).
+  ///
+  /// We do not split the edges on the fly. Indeed, this invalidates
+  /// the dominance information and thus triggers a lot of updates
+  /// of that information underneath.
+  /// Instead, we postpone all the splits after each iteration of
+  /// the main loop. That way, the information is at least valid
+  /// for the lifetime of an iteration.
+  ///
+  /// \return True if the edge is marked as toSplit, false otherwise.
+  /// False can be returned if, for instance, this is not profitable.
+  bool PostponeSplitCriticalEdge(MachineInstr &MI, MachineBasicBlock *From,
+                                 MachineBasicBlock *To, bool BreakPHIEdge);
+  bool SinkInstruction(MachineInstr &MI, bool &SawStore,
+                       AllSuccsCache &AllSuccessors);
+
+  /// If we sink a COPY inst, some debug users of it's destination may no
+  /// longer be dominated by the COPY, and will eventually be dropped.
+  /// This is easily rectified by forwarding the non-dominated debug uses
+  /// to the copy source.
+  void SalvageUnsunkDebugUsersOfCopy(MachineInstr &,
+                                     MachineBasicBlock *TargetBlock);
+  bool AllUsesDominatedByBlock(Register Reg, MachineBasicBlock *MBB,
+                               MachineBasicBlock *DefMBB, bool &BreakPHIEdge,
+                               bool &LocalUse) const;
+  MachineBasicBlock *FindSuccToSinkTo(MachineInstr &MI, MachineBasicBlock *MBB,
+                                      bool &BreakPHIEdge,
+                                      AllSuccsCache &AllSuccessors);
+
+  void FindCycleSinkCandidates(MachineCycle *Cycle, MachineBasicBlock *BB,
+                               SmallVectorImpl<MachineInstr *> &Candidates);
+  bool SinkIntoCycle(MachineCycle *Cycle, MachineInstr &I);
+
+  bool isProfitableToSinkTo(Register Reg, MachineInstr &MI,
+                            MachineBasicBlock *MBB,
+                            MachineBasicBlock *SuccToSinkTo,
+                            AllSuccsCache &AllSuccessors);
+
+  bool PerformTrivialForwardCoalescing(MachineInstr &MI,
+                                       MachineBasicBlock *MBB);
+
+  bool PerformSinkAndFold(MachineInstr &MI, MachineBasicBlock *MBB);
+
+  SmallVector<MachineBasicBlock *, 4> &
+  GetAllSortedSuccessors(MachineInstr &MI, MachineBasicBlock *MBB,
+                         AllSuccsCache &AllSuccessors) const;
+
+  std::vector<unsigned> &getBBRegisterPressure(const MachineBasicBlock &MBB);
+
+  bool registerPressureSetExceedsLimit(unsigned NRegs,
+                                       const TargetRegisterClass *RC,
+                                       const MachineBasicBlock &MBB);
+};
 
 } // end anonymous namespace
 
@@ -282,14 +282,14 @@ char MachineSinking::ID = 0;
 
 char &llvm::MachineSinkingID = MachineSinking::ID;
 
-INITIALIZE_PASS_BEGIN(MachineSinking, DEBUG_TYPE,
-                      "Machine code sinking", false, false)
+INITIALIZE_PASS_BEGIN(MachineSinking, DEBUG_TYPE, "Machine code sinking", false,
+                      false)
 INITIALIZE_PASS_DEPENDENCY(MachineBranchProbabilityInfoWrapperPass)
 INITIALIZE_PASS_DEPENDENCY(MachineDominatorTreeWrapperPass)
 INITIALIZE_PASS_DEPENDENCY(MachineCycleInfoWrapperPass)
 INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass)
-INITIALIZE_PASS_END(MachineSinking, DEBUG_TYPE,
-                    "Machine code sinking", false, false)
+INITIALIZE_PASS_END(MachineSinking, DEBUG_TYPE, "Machine code sinking", false,
+                    false)
 
 /// Return true if a target defined block prologue instruction interferes
 /// with a sink candidate.
@@ -640,7 +640,7 @@ bool MachineSinking::AllUsesDominatedByBlock(Register Reg,
     if (UseInst->isPHI()) {
       // PHI nodes use the operand in the predecessor block, not the block with
       // the PHI.
-      UseBlock = UseInst->getOperand(OpNo+1).getMBB();
+      UseBlock = UseInst->getOperand(OpNo + 1).getMBB();
     } else if (UseBlock == DefMBB) {
       LocalUse = true;
       return false;
@@ -740,7 +740,7 @@ bool MachineSinking::runOnMachineFunction(MachineFunction &MF) {
     CEBCandidates.clear();
     CEMergeCandidates.clear();
     ToSplit.clear();
-    for (auto &MBB: MF)
+    for (auto &MBB : MF)
       MadeChange |= ProcessBlock(MBB);
 
     // If we have anything we marked as toSplit, split it now.
@@ -761,7 +761,8 @@ bool MachineSinking::runOnMachineFunction(MachineFunction &MF) {
         LLVM_DEBUG(dbgs() << " *** Not legal to break critical edge\n");
     }
     // If this iteration over the code changed anything, keep iterating.
-    if (!MadeChange) break;
+    if (!MadeChange)
+      break;
     EverMadeChange = true;
   }
 
@@ -813,7 +814,8 @@ bool MachineSinking::ProcessBlock(MachineBasicBlock &MBB) {
   // Don't bother sinking code out of unreachable blocks. In addition to being
   // unprofitable, it can also lead to infinite looping, because in an
   // unreachable cycle there may be nowhere to stop.
-  if (!DT->isReachableFromEntry(&MBB)) return false;
+  if (!DT->isReachableFromEntry(&MBB))
+    return false;
 
   bool MadeChange = false;
 
@@ -825,7 +827,7 @@ bool MachineSinking::ProcessBlock(MachineBasicBlock &MBB) {
   --I;
   bool ProcessedBegin, SawStore = false;
   do {
-    MachineInstr &MI = *I;  // The instruction to sink.
+    MachineInstr &MI = *I; // The instruction to sink.
 
     // Predecrement I (if it's not begin) so that it isn't invalidated by
     // sinking.
@@ -921,8 +923,9 @@ bool MachineSinking::isWorthBreakingCriticalEdge(
     }
   }
 
-  if (From->isSuccessor(To) && MBPI->getEdgeProbability(From, To) <=
-      BranchProbability(SplitEdgeProbabilityThreshold, 100))
+  if (From->isSuccessor(To) &&
+      MBPI->getEdgeProbability(From, To) <=
+          BranchProbability(SplitEdgeProbabilityThreshold, 100))
     return true;
 
   // MI is cheap, we probably don't want to break the critical edge for it.
@@ -1096,7 +1099,7 @@ bool MachineSinking::isProfitableToSinkTo(Register Reg, MachineInstr &MI,
                                           MachineBasicBlock *MBB,
                                           MachineBasicBlock *SuccToSinkTo,
                                           AllSuccsCache &AllSuccessors) {
-  assert (SuccToSinkTo && "Invalid SinkTo Candidate BB");
+  assert(SuccToSinkTo && "Invalid SinkTo Candidate BB");
 
   if (MBB == SuccToSinkTo)
     return false;
@@ -1130,8 +1133,8 @@ bool MachineSinking::isProfitableToSinkTo(Register Reg, MachineInstr &MI,
 
   MachineCycle *MCycle = CI->getCycle(MBB);
 
-  // If the instruction is not inside a cycle, it is not profitable to sink MI to
-  // a post dominate block SuccToSinkTo.
+  // If the instruction is not inside a cycle, it is not profitable to sink MI
+  // to a post dominate block SuccToSinkTo.
   if (!MCycle)
     return false;
 
@@ -1147,7 +1150,8 @@ bool MachineSinking::isProfitableToSinkTo(Register Reg, MachineInstr &MI,
 
     if (Reg.isPhysical()) {
       // Don't handle non-constant and non-ignorable physical register uses.
-      if (MO.isUse() && !MRI->isConstantPhysReg(Reg) && !TII->isIgnorableUse(MO))
+      if (MO.isUse() && !MRI->isConstantPhysReg(Reg) &&
+          !TII->isIgnorableUse(MO))
         return false;
       continue;
     }
@@ -1235,7 +1239,7 @@ MachineBasicBlock *
 MachineSinking::FindSuccToSinkTo(MachineInstr &MI, MachineBasicBlock *MBB,
                                  bool &BreakPHIEdge,
                                  AllSuccsCache &AllSuccessors) {
-  assert (MBB && "Invalid MachineBasicBlock!");
+  assert(MBB && "Invalid MachineBasicBlock!");
 
   // loop over all the operands of the specified instruction.  If there is
   // anything we can't handle, bail out.
@@ -1244,10 +1248,12 @@ MachineSinking::FindSuccToSinkTo(MachineInstr &MI, MachineBasicBlock *MBB,
   // decide.
   MachineBasicBlock *SuccToSinkTo = nullptr;
   for (const MachineOperand &MO : MI.operands()) {
-    if (!MO.isReg()) continue;  // Ignore non-register operands.
+    if (!MO.isReg())
+      continue; // Ignore non-register operands.
 
     Register Reg = MO.getReg();
-    if (Reg == 0) continue;
+    if (Reg == 0)
+      continue;
 
     if (Reg.isPhysical()) {
       if (MO.isUse()) {
@@ -1262,7 +1268,8 @@ MachineSinking::FindSuccToSinkTo(MachineInstr &MI, MachineBasicBlock *MBB,
       }
     } else {
       // Virtual register uses are always safe to sink.
-      if (MO.isUse()) continue;
+      if (MO.isUse())
+        continue;
 
       // If it's not safe to move defs of the register class, then abort.
       if (!TII->isSafeToMoveRegClassDefs(MRI->getRegClass(Reg)))
@@ -1274,8 +1281,8 @@ MachineSinking::FindSuccToSinkTo(MachineInstr &MI, MachineBasicBlock *MBB,
         // If a previous operand picked a block to sink to, then this operand
         // must be sinkable to the same block.
         bool LocalUse = false;
-        if (!AllUsesDominatedByBlock(Reg, SuccToSinkTo, MBB,
-                                     BreakPHIEdge, LocalUse))
+        if (!AllUsesDominatedByBlock(Reg, SuccToSinkTo, MBB, BreakPHIEdge,
+                                     LocalUse))
           return nullptr;
 
         continue;
@@ -1288,8 +1295,8 @@ MachineSinking::FindSuccToSinkTo(MachineInstr &MI, MachineBasicBlock *MBB,
       for (MachineBasicBlock *SuccBlock :
            GetAllSortedSuccessors(MI, MBB, AllSuccessors)) {
         bool LocalUse = false;
-        if (AllUsesDominatedByBlock(Reg, SuccBlock, MBB,
-                                    BreakPHIEdge, LocalUse)) {
+        if (AllUsesDominatedByBlock(Reg, SuccBlock, MBB, BreakPHIEdge,
+                                    LocalUse)) {
           SuccToSinkTo = SuccBlock;
           break;
         }
@@ -1524,7 +1531,7 @@ bool MachineSinking::hasStoreBetween(MachineBasicBlock *From,
         for (auto *DomBB : HandledDomBlocks) {
           if (DomBB != BB && DT->dominates(DomBB, BB))
             HasStoreCache[std::make_pair(DomBB, To)] = true;
-          else if(DomBB != BB && DT->dominates(BB, DomBB))
+          else if (DomBB != BB && DT->dominates(BB, DomBB))
             HasStoreCache[std::make_pair(From, DomBB)] = true;
         }
         HasStoreCache[BlockPair] = true;
@@ -1538,7 +1545,7 @@ bool MachineSinking::hasStoreBetween(MachineBasicBlock *From,
           for (auto *DomBB : HandledDomBlocks) {
             if (DomBB != BB && DT->dominates(DomBB, BB))
               HasStoreCache[std::make_pair(DomBB, To)] = true;
-            else if(DomBB != BB && DT->dominates(BB, DomBB))
+            else if (DomBB != BB && DT->dominates(BB, DomBB))
               HasStoreCache[std::make_pair(From, DomBB)] = true;
           }
           HasStoreCache[BlockPair] = true;
@@ -1604,8 +1611,8 @@ bool MachineSinking::SinkIntoCycle(MachineCycle *Cycle, MachineInstr &I) {
       CanSink = false;
       break;
     }
-    LLVM_DEBUG(dbgs() << "CycleSink:   Setting nearest common dom block: " <<
-               printMBBReference(*SinkBlock) << "\n");
+    LLVM_DEBUG(dbgs() << "CycleSink:   Setting nearest common dom block: "
+                      << printMBBReference(*SinkBlock) << "\n");
   }
 
   if (!CanSink) {
@@ -1731,8 +1738,8 @@ bool MachineSinking::SinkInstruction(MachineInstr &MI, bool &SawStore,
       // Mark this edge as to be split.
       // If the edge can actually be split, the next iteration of the main loop
       // will sink MI in the newly created block.
-      bool Status =
-        PostponeSplitCriticalEdge(MI, ParentBlock, SuccToSinkTo, BreakPHIEdge);
+      bool Status = PostponeSplitCriticalEdge(MI, ParentBlock, SuccToSinkTo,
+                                              BreakPHIEdge);
       if (!Status)
         LLVM_DEBUG(dbgs() << " *** PUNTING: Not legal or profitable to "
                              "break critical edge\n");
@@ -1745,8 +1752,8 @@ bool MachineSinking::SinkInstruction(MachineInstr &MI, bool &SawStore,
     // BreakPHIEdge is true if all the uses are in the successor MBB being
     // sunken into and they are all PHI nodes. In this case, machine-sink must
     // break the critical edge first.
-    bool Status = PostponeSplitCriticalEdge(MI, ParentBlock,
-                                            SuccToSinkTo, BreakPHIEdge);
+    bool Status =
+        PostponeSplitCriticalEdge(MI, ParentBlock, SuccToSinkTo, BreakPHIEdge);
     if (!Status)
       LLVM_DEBUG(dbgs() << " *** PUNTING: Not legal or profitable to "
                            "break critical edge\n");



More information about the llvm-commits mailing list