[cfe-commits] r95623 - /cfe/trunk/lib/CodeGen/CodeGenFunction.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Mon Feb 8 16:10:00 PST 2010


Author: stoklund
Date: Mon Feb  8 18:10:00 2010
New Revision: 95623

URL: http://llvm.org/viewvc/llvm-project?rev=95623&view=rev
Log:
Pass inline keyword to optimizer as the new InlineHint function attribute.

At the moment the inlinehint attribute is ignored by the Inliner unless you
pass a -respect-inlinehint option.  This will soon be the default.

The inlinehint attribute is set if the inline keyword is explicitly specified
on any declaration.

Modified:
    cfe/trunk/lib/CodeGen/CodeGenFunction.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=95623&r1=95622&r2=95623&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Mon Feb  8 18:10:00 2010
@@ -171,6 +171,16 @@
   CurFn = Fn;
   assert(CurFn->isDeclaration() && "Function already has body?");
 
+  // Pass inline keyword to optimizer if it appears explicitly on any
+  // declaration.
+  if (const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D))
+    for (FunctionDecl::redecl_iterator RI = FD->redecls_begin(),
+           RE = FD->redecls_end(); RI != RE; ++RI)
+      if (RI->isInlineSpecified()) {
+        Fn->addFnAttr(llvm::Attribute::InlineHint);
+        break;
+      }
+
   llvm::BasicBlock *EntryBB = createBasicBlock("entry", CurFn);
 
   // Create a marker to make it easy to insert allocas into the entryblock





More information about the cfe-commits mailing list