]> granicus.if.org Git - llvm/commitdiff
[GlobalOpt] Swap the expensive check for cold calls with the cheap TTI check
authorJustin Bogner <mail@justinbogner.com>
Fri, 26 Apr 2019 00:12:50 +0000 (00:12 +0000)
committerJustin Bogner <mail@justinbogner.com>
Fri, 26 Apr 2019 00:12:50 +0000 (00:12 +0000)
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

index c89541dc73295c3294e6f8f2d29549f51cfdb777..a304d4e2dd9d68be96d6adbb9c78bda83264b065 100644 (file)
@@ -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;