[llvm-commits] [llvm] r66552 - in /llvm/branches/Apple/Dib: lib/Transforms/Utils/InlineCost.cpp test/Transforms/Inline/always_inline_dyn_alloca.ll

Bill Wendling isanbard at gmail.com
Tue Mar 10 10:37:31 PDT 2009


Author: void
Date: Tue Mar 10 12:37:31 2009
New Revision: 66552

URL: http://llvm.org/viewvc/llvm-project?rev=66552&view=rev
Log:
--- Merging (from foreign repository) r66539 into '.':
A    test/Transforms/Inline/always_inline_dyn_alloca.ll
U    lib/Transforms/Utils/InlineCost.cpp

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.

Added:
    llvm/branches/Apple/Dib/test/Transforms/Inline/always_inline_dyn_alloca.ll
Modified:
    llvm/branches/Apple/Dib/lib/Transforms/Utils/InlineCost.cpp

Modified: llvm/branches/Apple/Dib/lib/Transforms/Utils/InlineCost.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/Utils/InlineCost.cpp?rev=66552&r1=66551&r2=66552&view=diff

==============================================================================
--- llvm/branches/Apple/Dib/lib/Transforms/Utils/InlineCost.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Transforms/Utils/InlineCost.cpp Tue Mar 10 12:37:31 2009
@@ -227,6 +227,13 @@
   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];
@@ -242,13 +249,6 @@
       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

Added: llvm/branches/Apple/Dib/test/Transforms/Inline/always_inline_dyn_alloca.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/Transforms/Inline/always_inline_dyn_alloca.ll?rev=66552&view=auto

==============================================================================
--- llvm/branches/Apple/Dib/test/Transforms/Inline/always_inline_dyn_alloca.ll (added)
+++ llvm/branches/Apple/Dib/test/Transforms/Inline/always_inline_dyn_alloca.ll Tue Mar 10 12:37:31 2009
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -inline | llvm-dis | not grep callee
+; rdar://6655932
+
+; If callee is marked alwaysinline, inline it! Even if callee has dynamic
+; alloca and caller does not,
+
+define internal void @callee(i32 %N) alwaysinline {
+        %P = alloca i32, i32 %N
+        ret void
+}
+
+define void @foo(i32 %N) {
+        call void @callee( i32 %N )
+        ret void
+}





More information about the llvm-commits mailing list