From 9e601a405eb9e9953f4c0c608f5fa05b57ca9ccd Mon Sep 17 00:00:00 2001 From: Kyle Butt Date: Thu, 23 Feb 2017 21:22:24 +0000 Subject: [PATCH] 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296018 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/MachineBlockPlacement.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/CodeGen/MachineBlockPlacement.cpp b/lib/CodeGen/MachineBlockPlacement.cpp index b7ab25b87ea..889ccf0f196 100644 --- a/lib/CodeGen/MachineBlockPlacement.cpp +++ b/lib/CodeGen/MachineBlockPlacement.cpp @@ -309,8 +309,8 @@ class MachineBlockPlacement : public MachineFunctionPass { SmallVector BlockWorkList; SmallVector EHPadWorkList; - /// Edges that have already been computed as optimal by the trellis code. - DenseMap ComputedTrellisEdges; + /// Edges that have already been computed as optimal. + DenseMap ComputedEdges; /// \brief Machine Function MachineFunction *F; @@ -993,7 +993,7 @@ MachineBlockPlacement::getBestTrellisSuccessor( } // 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::selectBestSuccessor( 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 -- 2.40.0