<div dir="ltr">The more i think about it, the more I agree. =] I mostly agreed to start with, so I figure this is a good sign. Sorry to slow things down, just didn't want to take it for granted.</div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Jan 14, 2014 at 4:17 PM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">I find the LTO argument compellingly in favor of using the NoInline attribute.</div><div><div class="h5"><div class="gmail_quote"><br></div><div class="gmail_quote">
On Tue, Jan 14, 2014 at 3:31 PM, Chandler Carruth <span dir="ltr"><<a href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Are there strong reasons to do this by adding attributes rather than changing the optimizer's behavior? I'm uncertain.<div>

<br></div><div>On one hand, it would be more efficient in the optimizer to just switch to the always-inliner pass.</div>
<div><br></div><div>On the other hand, if we are doing an LTO build, adding attributes ensures that even the link-top inline step doesn't inline those functions.</div><div><br></div><div>On the other other hand, if we are doing an LTO build, we might want to only prevent inlining during the per-TU optimization run, not during the LTO optimization run.</div>


<div><br></div><div>Thoughts?</div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jan 14, 2014 at 11:58 AM, Roman Divacky <span dir="ltr"><<a href="mailto:rdivacky@freebsd.org" target="_blank">rdivacky@freebsd.org</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Currently -fno-inline doesnt do much, it just prevents adding InlineHint<br>
attributes. This means that we differ from gcc which prevents all<br>
functions (except always_inline) from inlining. This simple patch<br>
implements that behaviour, is that ok?<br>
<br>
Index: lib/CodeGen/CodeGenFunction.cpp<br>
===================================================================<br>
--- lib/CodeGen/CodeGenFunction.cpp     (revision 199224)<br>
+++ lib/CodeGen/CodeGenFunction.cpp     (working copy)<br>
@@ -510,7 +510,7 @@<br>
<br>
   // Pass inline keyword to optimizer if it appears explicitly on any<br>
   // declaration.<br>
-  if (!CGM.getCodeGenOpts().NoInline)<br>
+  if (!CGM.getCodeGenOpts().NoInline) {<br>
     if (const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D))<br>
       for (FunctionDecl::redecl_iterator RI = FD->redecls_begin(),<br>
              RE = FD->redecls_end(); RI != RE; ++RI)<br>
@@ -518,6 +518,10 @@<br>
           Fn->addFnAttr(llvm::Attribute::InlineHint);<br>
           break;<br>
         }<br>
+  } else if (const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D))<br>
+    if (!FD->hasAttr<AlwaysInlineAttr>() &&<br>
+        !FD->hasAttr<ForceInlineAttr>())<br>
+      Fn->addFnAttr(llvm::Attribute::NoInline);<br>
<br>
   if (getLangOpts().OpenCL) {<br>
     // Add metadata for a kernel function.<br>
Index: test/CodeGen/noinline.c<br>
===================================================================<br>
--- test/CodeGen/noinline.c     (revision 199224)<br>
+++ test/CodeGen/noinline.c     (working copy)<br>
@@ -7,6 +7,7 @@<br>
<br>
 volatile int *pa = (int*) 0x1000;<br>
 void foo() {<br>
+// NOINLINE: Function Attrs: noinline<br>
 // NOINLINE: @foo<br>
 // NOINLINE: dont_inline_me<br>
 // NOINLINE-NOT: inlinehint<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>