diff options
author | Owen Anderson <resistor@mac.com> | 2010-09-09 20:32:23 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2010-09-09 20:32:23 +0000 |
commit | f9a26b89f8815651048ed5518d99b484ac7c2ba0 (patch) | |
tree | 796d42a0dd32f512e44d2c5ea66174a3a5df7ff5 /lib/Analysis | |
parent | ce07b5458d87d5f5ad306a1d86785537e9a3ce0c (diff) | |
download | external_llvm-f9a26b89f8815651048ed5518d99b484ac7c2ba0.zip external_llvm-f9a26b89f8815651048ed5518d99b484ac7c2ba0.tar.gz external_llvm-f9a26b89f8815651048ed5518d99b484ac7c2ba0.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113535 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/InlineCost.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Analysis/InlineCost.cpp b/lib/Analysis/InlineCost.cpp index ee2657c..afdf474 100644 --- a/lib/Analysis/InlineCost.cpp +++ b/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; |