aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/IPO/InlineSimple.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/IPO/InlineSimple.cpp')
-rw-r--r--lib/Transforms/IPO/InlineSimple.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp
index b3421eb..a7aeed8 100644
--- a/lib/Transforms/IPO/InlineSimple.cpp
+++ b/lib/Transforms/IPO/InlineSimple.cpp
@@ -43,7 +43,16 @@ namespace {
}
static char ID; // Pass identification, replacement for typeid
InlineCost getInlineCost(CallSite CS) {
- return CA.getInlineCost(CS, NeverInline);
+ // Filter out functions which should never be inlined due to the global
+ // 'llvm.noinline'.
+ // FIXME: I'm 99% certain that this is an ancient bit of legacy that we
+ // no longer need to support, but I don't want to blindly nuke it just
+ // yet.
+ if (Function *Callee = CS.getCalledFunction())
+ if (NeverInline.count(Callee))
+ return InlineCost::getNever();
+
+ return CA.getInlineCost(CS);
}
float getInlineFudgeFactor(CallSite CS) {
return CA.getInlineFudgeFactor(CS);
@@ -81,11 +90,6 @@ bool SimpleInliner::doInitialization(CallGraph &CG) {
Module &M = CG.getModule();
- for (Module::iterator I = M.begin(), E = M.end();
- I != E; ++I)
- if (!I->isDeclaration() && I->hasFnAttr(Attribute::NoInline))
- NeverInline.insert(I);
-
// Get llvm.noinline
GlobalVariable *GV = M.getNamedGlobal("llvm.noinline");