diff options
Diffstat (limited to 'llvm/lib/Transforms/IPO/HotColdSplitting.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/HotColdSplitting.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp index 5e690714bfdf..d0bd0166534a 100644 --- a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp +++ b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp @@ -39,7 +39,6 @@ #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/CFG.h" -#include "llvm/IR/CallSite.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/Dominators.h" @@ -110,8 +109,8 @@ bool unlikelyExecuted(BasicBlock &BB) { // The block is cold if it calls/invokes a cold function. However, do not // mark sanitizer traps as cold. for (Instruction &I : BB) - if (auto CS = CallSite(&I)) - if (CS.hasFnAttr(Attribute::Cold) && !CS->getMetadata("nosanitize")) + if (auto *CB = dyn_cast<CallBase>(&I)) + if (CB->hasFnAttr(Attribute::Cold) && !CB->getMetadata("nosanitize")) return true; // The block is cold if it has an unreachable terminator, unless it's @@ -325,11 +324,10 @@ Function *HotColdSplitting::extractColdRegion( if (Function *OutF = CE.extractCodeRegion(CEAC)) { User *U = *OutF->user_begin(); CallInst *CI = cast<CallInst>(U); - CallSite CS(CI); NumColdRegionsOutlined++; if (TTI.useColdCCForColdCall(*OutF)) { OutF->setCallingConv(CallingConv::Cold); - CS.setCallingConv(CallingConv::Cold); + CI->setCallingConv(CallingConv::Cold); } CI->setIsNoInline(); @@ -458,6 +456,10 @@ public: // first have predecessors within the extraction region. if (mayExtractBlock(SinkBB)) { addBlockToRegion(&SinkBB, SinkScore); + if (pred_empty(&SinkBB)) { + ColdRegion->EntireFunctionCold = true; + return Regions; + } } else { Regions.emplace_back(); ColdRegion = &Regions.back(); |