summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2010-09-09 20:32:23 +0000
committerOwen Anderson <resistor@mac.com>2010-09-09 20:32:23 +0000
commit04cf3fd7612150cfb3e0f92b490d821a0dd7aa0c (patch)
treee517e256622550619c147103ed230d242db45d4e /llvm/lib/Analysis
parent324f8b798fb28f4eb04e9e5dc44e3c3cdf63b398 (diff)
downloadbcm5719-llvm-04cf3fd7612150cfb3e0f92b490d821a0dd7aa0c.tar.gz
bcm5719-llvm-04cf3fd7612150cfb3e0f92b490d821a0dd7aa0c.zip
What the loop unroller cares about, rather than just not unrolling loops with calls, is
not unrolling loops that contain calls that would be better off getting inlined. This mostly comes up when an interleaved devirtualization pass has devirtualized a call which the inliner will inline on a future pass. Thus, rather than blocking all loops containing calls, add a metric for "inline candidate calls" and block loops containing those instead. llvm-svn: 113535
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index ee2657c58e5..afdf474c616 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -70,6 +70,12 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB) {
// variables as volatile if they are live across a setjmp call, and they
// probably won't do this in callers.
if (const Function *F = CS.getCalledFunction()) {
+ // If a function is both internal and has a single use, then it is
+ // extremely likely to get inlined in the future (it was probably
+ // exposed by an interleaved devirtualization pass).
+ if (F->hasInternalLinkage() && F->hasOneUse())
+ ++NumInlineCandidates;
+
if (F->isDeclaration() &&
(F->getName() == "setjmp" || F->getName() == "_setjmp"))
callsSetJmp = true;
OpenPOWER on IntegriCloud