summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-09-02 22:16:13 +0000
committerDevang Patel <dpatel@apple.com>2008-09-02 22:16:13 +0000
commit691e52445e2a32d237fc23073fbaf93fb96ce584 (patch)
tree237618f2ff48d969a6b1c7a13a8f7f01cfc5dd3d /lib/Transforms/IPO
parent36fd941fc029c6ea50ed08d26a2bfe4932b9789c (diff)
downloadllvm-691e52445e2a32d237fc23073fbaf93fb96ce584.tar.gz
llvm-691e52445e2a32d237fc23073fbaf93fb96ce584.tar.bz2
llvm-691e52445e2a32d237fc23073fbaf93fb96ce584.tar.xz
respect inline=never and inline=always notes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55673 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r--lib/Transforms/IPO/Inliner.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp
index 1c3d5a81f3..e9ae21f795 100644
--- a/lib/Transforms/IPO/Inliner.cpp
+++ b/lib/Transforms/IPO/Inliner.cpp
@@ -140,7 +140,14 @@ bool Inliner::runOnSCC(const std::vector<CallGraphNode*> &SCC) {
int InlineCost = getInlineCost(CS);
float FudgeFactor = getInlineFudgeFactor(CS);
- if (InlineCost >= (int)(InlineThreshold * FudgeFactor)) {
+ Function *Fn = CS.getCalledFunction();
+ bool AlwaysInline = false;
+ if (Fn && (Fn->getNotes() & FP_AlwaysInline))
+ AlwaysInline = true;
+ if (Fn && (Fn->getNotes() & FP_NoInline))
+ DOUT << "NOT Inlining: inline=never is set" << *CS.getInstruction();
+ else if (!AlwaysInline
+ && InlineCost >= (int)(InlineThreshold * FudgeFactor)) {
DOUT << " NOT Inlining: cost=" << InlineCost
<< ", Call: " << *CS.getInstruction();
} else {