If a function is marked alwaysinline, it must be inlined (possibly for correctness...
[oota-llvm.git] / lib / Transforms / Utils / InlineCost.cpp
index 209ba9271817ca6f1c7633d7eaeae0927e5c2d0e..ce8b542bdf4456e9197b3dbbbf50661cd4e96444 100644 (file)
@@ -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