summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/IPA/InlineCost.cpp
diff options
context:
space:
mode:
authorPaul Robinson <paul_robinson@playstation.sony.com>2013-11-18 21:44:03 +0000
committerPaul Robinson <paul_robinson@playstation.sony.com>2013-11-18 21:44:03 +0000
commitdcbe35bad518b0b8ec8b9329a66104448b1e0394 (patch)
tree3839029ed02de18f49c107ad849b29419ad1c4fe /llvm/lib/Analysis/IPA/InlineCost.cpp
parentf16f037060450854afa323f5d9df423046ad03b6 (diff)
downloadbcm5719-llvm-dcbe35bad518b0b8ec8b9329a66104448b1e0394.tar.gz
bcm5719-llvm-dcbe35bad518b0b8ec8b9329a66104448b1e0394.zip
The 'optnone' attribute means don't inline anything into this function
(except functions marked always_inline). Functions with 'optnone' must also have 'noinline' so they don't get inlined into any other function. Based on work by Andrea Di Biagio. llvm-svn: 195046
Diffstat (limited to 'llvm/lib/Analysis/IPA/InlineCost.cpp')
-rw-r--r--llvm/lib/Analysis/IPA/InlineCost.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/IPA/InlineCost.cpp b/llvm/lib/Analysis/IPA/InlineCost.cpp
index 89dcd819ee2..013691b668b 100644
--- a/llvm/lib/Analysis/IPA/InlineCost.cpp
+++ b/llvm/lib/Analysis/IPA/InlineCost.cpp
@@ -1206,6 +1206,10 @@ InlineCost InlineCostAnalysis::getInlineCost(CallSite CS, Function *Callee,
if (!functionsHaveCompatibleAttributes(CS.getCaller(), Callee))
return llvm::InlineCost::getNever();
+ // Don't inline this call if the caller has the optnone attribute.
+ if (CS.getCaller()->hasFnAttribute(Attribute::OptimizeNone))
+ return llvm::InlineCost::getNever();
+
// Don't inline functions which can be redefined at link-time to mean
// something else. Don't inline functions marked noinline or call sites
// marked noinline.
OpenPOWER on IntegriCloud