aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/InlineCost.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-03-10 07:57:50 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-03-10 07:57:50 +0000
commit8c7848f17f2eff731c9f46e286fdd337a5c7e642 (patch)
treef5f7148ba72736147f096054c7ad6cc49cf40e9e /lib/Transforms/Utils/InlineCost.cpp
parent3528e38fdf579685f32ebbea209359d91d4a4524 (diff)
If a function is marked alwaysinline, it must be inlined (possibly for correctness). Do so even if the callee has dynamic alloca and the caller doesn't.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66539 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/InlineCost.cpp')
-rw-r--r--lib/Transforms/Utils/InlineCost.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/Transforms/Utils/InlineCost.cpp b/lib/Transforms/Utils/InlineCost.cpp
index 209ba92718..ce8b542bdf 100644
--- a/lib/Transforms/Utils/InlineCost.cpp
+++ b/lib/Transforms/Utils/InlineCost.cpp
@@ -224,6 +224,13 @@ InlineCost InlineCostAnalyzer::getInlineCost(CallSite CS,
if (CalleeFI.NeverInline)
return InlineCost::getNever();
+ // FIXME: It would be nice to kill off CalleeFI.NeverInline. Then we
+ // could move this up and avoid computing the FunctionInfo for
+ // things we are going to just return always inline for. This
+ // requires handling setjmp somewhere else, however.
+ if (!Callee->isDeclaration() && Callee->hasFnAttr(Attribute::AlwaysInline))
+ return InlineCost::getAlways();
+
if (CalleeFI.usesDynamicAlloca) {
// Get infomation about the caller...
FunctionInfo &CallerFI = CachedFunctionInfo[Caller];
@@ -239,13 +246,6 @@ InlineCost InlineCostAnalyzer::getInlineCost(CallSite CS,
return InlineCost::getNever();
}
- // FIXME: It would be nice to kill off CalleeFI.NeverInline. Then we
- // could move this up and avoid computing the FunctionInfo for
- // things we are going to just return always inline for. This
- // requires handling setjmp somewhere else, however.
- if (!Callee->isDeclaration() && Callee->hasFnAttr(Attribute::AlwaysInline))
- return InlineCost::getAlways();
-
// Add to the inline quality for properties that make the call valuable to
// inline. This includes factors that indicate that the result of inlining
// the function will be optimizable. Currently this just looks at arguments