mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 00:24:26 +00:00
Inliner uses a smaller inline threshold for callees with cold attribute.
Added command line option inlinecold-threshold to set threshold for inlining functions with cold attribute. Listen to the cold attribute when it would decrease the inline threshold. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200886 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -50,6 +50,10 @@ static cl::opt<int>
|
||||
HintThreshold("inlinehint-threshold", cl::Hidden, cl::init(325),
|
||||
cl::desc("Threshold for inlining functions with inline hint"));
|
||||
|
||||
static cl::opt<int>
|
||||
ColdThreshold("inlinecold-threshold", cl::Hidden, cl::init(75),
|
||||
cl::desc("Threshold for inlining functions with cold attribute"));
|
||||
|
||||
// Threshold to use when optsize is specified (and there is no -inline-limit).
|
||||
const int OptSizeThreshold = 75;
|
||||
|
||||
@ -277,6 +281,13 @@ unsigned Inliner::getInlineThreshold(CallSite CS) const {
|
||||
Attribute::MinSize))
|
||||
thres = HintThreshold;
|
||||
|
||||
// Listen to the cold attribute when it would decrease the threshold.
|
||||
bool ColdCallee = Callee && !Callee->isDeclaration() &&
|
||||
Callee->getAttributes().hasAttribute(AttributeSet::FunctionIndex,
|
||||
Attribute::Cold);
|
||||
if (ColdCallee && ColdThreshold < thres)
|
||||
thres = ColdThreshold;
|
||||
|
||||
return thres;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user