From 20aded591214b67295c875fb8b7e4ed5e034f6bd Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Wed, 21 Dec 2011 06:06:30 +0000 Subject: [PATCH] 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! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147037 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/InlineCost.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Analysis/InlineCost.cpp b/lib/Analysis/InlineCost.cpp index 7f0b0cc3bf1..14bdd40efcf 100644 --- a/lib/Analysis/InlineCost.cpp +++ b/lib/Analysis/InlineCost.cpp @@ -63,8 +63,8 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB, // Special handling for calls. if (isa(II) || isa(II)) { - if (isa(II)) - continue; // Debug intrinsics don't count as size. + if (isa(II)) + continue; // Intrinsics have no argument setup and can't be inlined. ImmutableCallSite CS(cast(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(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(); -- 2.34.1