From 7fa27ce4a07f19b07799a767fc29416f3b625afb Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Wed, 26 Jul 2023 21:03:47 +0200 Subject: Vendor import of llvm-project main llvmorg-17-init-19304-gd0b54bb50e51, the last commit before the upstream release/17.x branch was created. --- llvm/lib/CodeGen/MachineBlockPlacement.cpp | 31 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'llvm/lib/CodeGen/MachineBlockPlacement.cpp') diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp index 7bbc347a8cf8..912e9ec993e3 100644 --- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp +++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp @@ -213,10 +213,9 @@ static cl::opt RenumberBlocksBeforeView( "into a dot graph. Only used when a function is being printed."), cl::init(false), cl::Hidden); +namespace llvm { extern cl::opt EnableExtTspBlockPlacement; extern cl::opt ApplyExtTspWithoutProfile; - -namespace llvm { extern cl::opt StaticLikelyProb; extern cl::opt ProfileLikelyProb; @@ -354,15 +353,15 @@ class MachineBlockPlacement : public MachineFunctionPass { /// Pair struct containing basic block and taildup profitability struct BlockAndTailDupResult { - MachineBasicBlock *BB; + MachineBasicBlock *BB = nullptr; bool ShouldTailDup; }; /// Triple struct containing edge weight and the edge. struct WeightedEdge { BlockFrequency Weight; - MachineBasicBlock *Src; - MachineBasicBlock *Dest; + MachineBasicBlock *Src = nullptr; + MachineBasicBlock *Dest = nullptr; }; /// work lists of blocks that are ready to be laid out @@ -373,32 +372,32 @@ class MachineBlockPlacement : public MachineFunctionPass { DenseMap ComputedEdges; /// Machine Function - MachineFunction *F; + MachineFunction *F = nullptr; /// A handle to the branch probability pass. - const MachineBranchProbabilityInfo *MBPI; + const MachineBranchProbabilityInfo *MBPI = nullptr; /// A handle to the function-wide block frequency pass. std::unique_ptr MBFI; /// A handle to the loop info. - MachineLoopInfo *MLI; + MachineLoopInfo *MLI = nullptr; /// Preferred loop exit. /// Member variable for convenience. It may be removed by duplication deep /// in the call stack. - MachineBasicBlock *PreferredLoopExit; + MachineBasicBlock *PreferredLoopExit = nullptr; /// A handle to the target's instruction info. - const TargetInstrInfo *TII; + const TargetInstrInfo *TII = nullptr; /// A handle to the target's lowering info. - const TargetLoweringBase *TLI; + const TargetLoweringBase *TLI = nullptr; /// A handle to the post dominator tree. - MachinePostDominatorTree *MPDT; + MachinePostDominatorTree *MPDT = nullptr; - ProfileSummaryInfo *PSI; + ProfileSummaryInfo *PSI = nullptr; /// Duplicator used to duplicate tails during placement. /// @@ -412,7 +411,7 @@ class MachineBlockPlacement : public MachineFunctionPass { /// True: use block profile count to compute tail duplication cost. /// False: use block frequency to compute tail duplication cost. - bool UseProfileCount; + bool UseProfileCount = false; /// Allocator and owner of BlockChain structures. /// @@ -1160,7 +1159,7 @@ bool MachineBlockPlacement::canTailDuplicateUnplacedPreds( // tail-duplicated into. // Skip any blocks that are already placed or not in this loop. if (Pred == BB || (BlockFilter && !BlockFilter->count(Pred)) - || BlockToChain[Pred] == &Chain) + || (BlockToChain[Pred] == &Chain && !Succ->succ_empty())) continue; if (!TailDup.canTailDuplicate(Succ, Pred)) { if (Successors.size() > 1 && hasSameSuccessors(*Pred, Successors)) @@ -2018,7 +2017,7 @@ MachineBlockPlacement::FallThroughGains( for (MachineBasicBlock *Succ : BestPred->successors()) { if ((Succ == NewTop) || (Succ == BestPred) || !LoopBlockSet.count(Succ)) continue; - if (ComputedEdges.find(Succ) != ComputedEdges.end()) + if (ComputedEdges.contains(Succ)) continue; BlockChain *SuccChain = BlockToChain[Succ]; if ((SuccChain && (Succ != *SuccChain->begin())) || -- cgit v1.3