[llvm] r296018 - CodeGen: MachineBlockPlacement: Rename member to more general name. NFC.

Kyle Butt via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 23 13:22:25 PST 2017


Author: iteratee
Date: Thu Feb 23 15:22:24 2017
New Revision: 296018

URL: http://llvm.org/viewvc/llvm-project?rev=296018&view=rev
Log:
CodeGen: MachineBlockPlacement: Rename member to more general name. NFC.

Rename ComputedTrellisEdges to ComputedEdges to allow for other methods of
pre-computing edges.

Differential Revision: https://reviews.llvm.org/D30308

Modified:
    llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp

Modified: llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp?rev=296018&r1=296017&r2=296018&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp Thu Feb 23 15:22:24 2017
@@ -309,8 +309,8 @@ class MachineBlockPlacement : public Mac
   SmallVector<MachineBasicBlock *, 16> BlockWorkList;
   SmallVector<MachineBasicBlock *, 16> EHPadWorkList;
 
-  /// Edges that have already been computed as optimal by the trellis code.
-  DenseMap<const MachineBasicBlock *, MachineBasicBlock *> ComputedTrellisEdges;
+  /// Edges that have already been computed as optimal.
+  DenseMap<const MachineBasicBlock *, BlockAndTailDupResult> ComputedEdges;
 
   /// \brief Machine Function
   MachineFunction *F;
@@ -993,7 +993,7 @@ MachineBlockPlacement::getBestTrellisSuc
   }
   // We have already computed the optimal edge for the other side of the
   // trellis.
-  ComputedTrellisEdges[BestB.Src] = BestB.Dest;
+  ComputedEdges[BestB.Src] = { BestB.Dest, false };
 
   auto TrellisSucc = BestA.Dest;
   DEBUG(BranchProbability SuccProb = getAdjustedProbability(
@@ -1329,18 +1329,16 @@ MachineBlockPlacement::selectBestSuccess
 
   DEBUG(dbgs() << "Selecting best successor for: " << getBlockName(BB) << "\n");
 
-  // if we already precomputed the best successor for BB as part of a trellis we
-  // saw earlier, return that if still applicable.
-  auto FoundEdge = ComputedTrellisEdges.find(BB);
-  if (FoundEdge != ComputedTrellisEdges.end()) {
-    MachineBasicBlock *Succ = FoundEdge->second;
-    ComputedTrellisEdges.erase(FoundEdge);
+  // if we already precomputed the best successor for BB, return that if still
+  // applicable.
+  auto FoundEdge = ComputedEdges.find(BB);
+  if (FoundEdge != ComputedEdges.end()) {
+    MachineBasicBlock *Succ = FoundEdge->second.BB;
+    ComputedEdges.erase(FoundEdge);
     BlockChain *SuccChain = BlockToChain[Succ];
     if (BB->isSuccessor(Succ) && (!BlockFilter || BlockFilter->count(Succ)) &&
-        SuccChain != &Chain && Succ == *SuccChain->begin()) {
-      BestSucc.BB = Succ;
-      return BestSucc;
-    }
+        SuccChain != &Chain && Succ == *SuccChain->begin())
+      return FoundEdge->second;
   }
 
   // if BB is part of a trellis, Use the trellis to determine the optimal




More information about the llvm-commits mailing list