From baf32fac2bf72513cf012b86f7c675d1e1ce52fd Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Fri, 26 Apr 2019 00:12:50 +0000 Subject: [PATCH] [GlobalOpt] Swap the expensive check for cold calls with the cheap TTI check isValidCandidateForColdCC is much more expensive than TTI.useColdCCForColdCall, which by default just returns false. Avoid doing this work if we're not going to look at the answer anyway. This change is NFC, but I see significant compile time improvements on some code with pathologically many functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359253 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/IPO/GlobalOpt.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index c89541dc732..a304d4e2dd9 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -2295,8 +2295,8 @@ OptimizeFunctions(Module &M, TargetLibraryInfo *TLI, // cold at all call sites and the callers contain no other non coldcc // calls. if (EnableColdCCStressTest || - (isValidCandidateForColdCC(*F, GetBFI, AllCallsCold) && - TTI.useColdCCForColdCall(*F))) { + (TTI.useColdCCForColdCall(*F) && + isValidCandidateForColdCC(*F, GetBFI, AllCallsCold))) { F->setCallingConv(CallingConv::Cold); changeCallSitesToColdCC(F); Changed = true; -- 2.50.1