summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-02-13 01:51:53 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-02-13 01:51:53 +0000
commit492b8b42cd7f72f977eef4e0f73768a8a5b47d41 (patch)
treeee6e4e6a4ccb44d47784df08270319b30ce5df22 /llvm/lib/Transforms/IPO
parent44232af55a8360c5477c24679dccd5a34e89cd11 (diff)
downloadbcm5719-llvm-492b8b42cd7f72f977eef4e0f73768a8a5b47d41.tar.gz
bcm5719-llvm-492b8b42cd7f72f977eef4e0f73768a8a5b47d41.zip
Enable the inlinehint attribute in the Inliner.
Functions explicitly marked inline will get an inlining threshold slightly more aggressive than the default for -O3. This means than -O3 builds are mostly unaffected while -Os builds will be a bit bigger and faster. The difference depends entirely on how many 'inline's are sprinkled on the source. In the CINT2006 suite, only these tests are significantly affected under -Os: Size Time 471.omnetpp +1.63% -1.85% 473.astar +4.01% -6.02% 483.xalancbmk +4.60% 0.00% Note that 483.xalancbmk runs too quickly to give useful timing results. llvm-svn: 96066
Diffstat (limited to 'llvm/lib/Transforms/IPO')
-rw-r--r--llvm/lib/Transforms/IPO/Inliner.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp
index 97e2f063946..752a97c99c0 100644
--- a/llvm/lib/Transforms/IPO/Inliner.cpp
+++ b/llvm/lib/Transforms/IPO/Inliner.cpp
@@ -41,12 +41,9 @@ static cl::opt<int>
InlineLimit("inline-threshold", cl::Hidden, cl::init(225), cl::ZeroOrMore,
cl::desc("Control the amount of inlining to perform (default = 225)"));
-static cl::opt<bool>
-RespectHint("respect-inlinehint", cl::Hidden,
- cl::desc("Respect the inlinehint attribute"));
-
-// Threshold to use when inlinehint is given.
-const int HintThreshold = 300;
+static cl::opt<int>
+HintThreshold("inlinehint-threshold", cl::Hidden, cl::init(325),
+ cl::desc("Threshold for inlining functions with inline hint"));
// Threshold to use when optsize is specified (and there is no -inline-limit).
const int OptSizeThreshold = 75;
@@ -183,20 +180,22 @@ static bool InlineCallIfPossible(CallSite CS, CallGraph &CG,
}
unsigned Inliner::getInlineThreshold(CallSite CS) const {
- // Listen to inlinehint when -respect-inlinehint is given.
- Function *Callee = CS.getCalledFunction();
- if (RespectHint && Callee && !Callee->isDeclaration() &&
- Callee->hasFnAttr(Attribute::InlineHint))
- return HintThreshold;
+ int thres = InlineThreshold;
// Listen to optsize when -inline-limit is not given.
Function *Caller = CS.getCaller();
if (Caller && !Caller->isDeclaration() &&
Caller->hasFnAttr(Attribute::OptimizeForSize) &&
InlineLimit.getNumOccurrences() == 0)
- return OptSizeThreshold;
+ thres = OptSizeThreshold;
+
+ // Listen to inlinehint when it would increase the threshold.
+ Function *Callee = CS.getCalledFunction();
+ if (HintThreshold > thres && Callee && !Callee->isDeclaration() &&
+ Callee->hasFnAttr(Attribute::InlineHint))
+ thres = HintThreshold;
- return InlineThreshold;
+ return thres;
}
/// shouldInline - Return true if the inliner should attempt to inline
OpenPOWER on IntegriCloud