From 3822939ba79fbae0cd7464a403ffb63fca53471b Mon Sep 17 00:00:00 2001 From: Jun Bum Lim Date: Fri, 23 Sep 2016 17:26:14 +0000 Subject: Enhance calcColdCallHeuristics for InvokeInst Summary: When identifying cold blocks, consider only the edge to the normal destination if the terminator is InvokeInst and let calcInvokeHeuristics() decide edge weights for the InvokeInst. Reviewers: mcrosier, hfinkel, davidxl Subscribers: mcrosier, llvm-commits Differential Revision: https://reviews.llvm.org/D24868 llvm-svn: 282262 --- llvm/lib/Analysis/BranchProbabilityInfo.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'llvm/lib/Analysis/BranchProbabilityInfo.cpp') diff --git a/llvm/lib/Analysis/BranchProbabilityInfo.cpp b/llvm/lib/Analysis/BranchProbabilityInfo.cpp index bf02653b492..0228e895879 100644 --- a/llvm/lib/Analysis/BranchProbabilityInfo.cpp +++ b/llvm/lib/Analysis/BranchProbabilityInfo.cpp @@ -279,6 +279,16 @@ bool BranchProbabilityInfo::calcColdCallHeuristics(const BasicBlock *BB) { } } + if (auto *II = dyn_cast(TI)) { + // If the terminator is an InvokeInst, consider only the normal destination + // block. + if (PostDominatedByColdCall.count(II->getNormalDest())) + PostDominatedByColdCall.insert(BB); + // Return false here so that edge weights for InvokeInst could be decided + // in calcInvokeHeuristics(). + return false; + } + // Skip probabilities if this block has a single successor. if (TI->getNumSuccessors() == 1 || ColdEdges.empty()) return false; -- cgit v1.2.3