Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Transforms/IPO/HotColdSplitting.cpp
Show First 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | if (auto CS = CallSite(&I)) | ||||
if (CS.hasFnAttr(Attribute::Cold) && !CS->getMetadata("nosanitize")) | if (CS.hasFnAttr(Attribute::Cold) && !CS->getMetadata("nosanitize")) | ||||
return true; | return true; | ||||
// The block is cold if it has an unreachable terminator, unless it's | // The block is cold if it has an unreachable terminator, unless it's | ||||
// preceded by a call to a (possibly warm) noreturn call (e.g. longjmp). | // preceded by a call to a (possibly warm) noreturn call (e.g. longjmp). | ||||
if (blockEndsInUnreachable(BB)) { | if (blockEndsInUnreachable(BB)) { | ||||
if (auto *CI = | if (auto *CI = | ||||
dyn_cast_or_null<CallInst>(BB.getTerminator()->getPrevNode())) | dyn_cast_or_null<CallInst>(BB.getTerminator()->getPrevNode())) | ||||
if (CI->hasFnAttr(Attribute::NoReturn)) | if (CI->hasFnAttr(Attribute::NoReturn)) { | ||||
return false; | if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(CI)) | ||||
return II->getIntrinsicID() != Intrinsic::longjmp; | |||||
hiraditya: TODO: if profile information is available, make use of that here. | |||||
rjfAuthorUnsubmitted add use of profile information. rjf: add use of profile information. | |||||
CallSite CS(CI); | |||||
return !CS.getCalledFunction()->getName().startswith("longjmp"); | |||||
} | |||||
return true; | return true; | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
/// Check whether it's safe to outline \p BB. | /// Check whether it's safe to outline \p BB. | ||||
static bool mayExtractBlock(const BasicBlock &BB) { | static bool mayExtractBlock(const BasicBlock &BB) { | ||||
▲ Show 20 Lines • Show All 605 Lines • Show Last 20 Lines |
TODO: if profile information is available, make use of that here.