summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-12-21 06:06:30 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-12-21 06:06:30 +0000
commitda22fc6a1de07cfd48191c700c26dbceeca1731f (patch)
tree5c128086932a29786ecebaf24465f193bfb94f6b /llvm/lib
parentb4039f633cc14f798b6bafc14b29e8f4cf66c618 (diff)
downloadbcm5719-llvm-da22fc6a1de07cfd48191c700c26dbceeca1731f.tar.gz
bcm5719-llvm-da22fc6a1de07cfd48191c700c26dbceeca1731f.zip
A call to a function marked 'noinline' is not an inline candidate. The sole
call site of an intrinsic is also not an inline candidate. While here, make it more obvious that this code ignores all intrinsics. Noticed by inspection! llvm-svn: 147037
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 7f0b0cc3bf1..14bdd40efcf 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -63,8 +63,8 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB,
// Special handling for calls.
if (isa<CallInst>(II) || isa<InvokeInst>(II)) {
- if (isa<DbgInfoIntrinsic>(II))
- continue; // Debug intrinsics don't count as size.
+ if (isa<IntrinsicInst>(II))
+ continue; // Intrinsics have no argument setup and can't be inlined.
ImmutableCallSite CS(cast<Instruction>(II));
@@ -72,7 +72,7 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB,
// 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())
+ if (!CS.isNoInline() && F->hasInternalLinkage() && F->hasOneUse())
++NumInlineCandidates;
// If this call is to function itself, then the function is recursive.
@@ -83,7 +83,7 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB,
isRecursive = true;
}
- if (!isa<IntrinsicInst>(II) && !callIsSmall(CS.getCalledFunction())) {
+ if (!callIsSmall(CS.getCalledFunction())) {
// Each argument to a call takes on average one instruction to set up.
NumInsts += CS.arg_size();
OpenPOWER on IntegriCloud