[llvm-commits] [llvm-gcc-4.2] r103572 - in /llvm-gcc-4.2/trunk/gcc: cgraph.h cp/semantics.c

Dale Johannesen dalej at apple.com
Tue May 11 22:02:13 PDT 2010


Author: johannes
Date: Wed May 12 00:02:13 2010
New Revision: 103572

URL: http://llvm.org/viewvc/llvm-project?rev=103572&view=rev
Log:
Make sure always_inline is honored on instantiated functions.
cgraph was removing these in the belief the inlining had
already been done.   7898991.


Modified:
    llvm-gcc-4.2/trunk/gcc/cgraph.h
    llvm-gcc-4.2/trunk/gcc/cp/semantics.c

Modified: llvm-gcc-4.2/trunk/gcc/cgraph.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cgraph.h?rev=103572&r1=103571&r2=103572&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cgraph.h (original)
+++ llvm-gcc-4.2/trunk/gcc/cgraph.h Wed May 12 00:02:13 2010
@@ -342,8 +342,14 @@
    C++ uses DECL_EXTERNAL to mark functions instantiated as part of
    template instantiation which should not be emitted. Objective C uses
    it for some other convoluted purpose.  Functions marked this way in
-   other languages should not be passed down to the LLVM BE.  The easiest
+   other languages should not be passed down to the LLVM BE (except functions
+   marked always_inline should be passed down in all languages).  The easiest
    way to outwit this, although inelegant, seems to be to check the language.
+   IS_EXTERN_NOINLINE seems a reasonable name for this quality.
+
+   IS_EXTERN_INLINE, on the other hand, describes functions that have the
+   semantics of "extern inline" in C99.  As such it is not the inverse of
+   IS_EXTERN_NOINLINE.  Sorry about that.
 
    Weak extern inlines are treated as weak.
 
@@ -356,6 +362,7 @@
            !lookup_attribute ("weak", DECL_ATTRIBUTES (f)) && \
            strcmp (lang_hooks.name, "GNU C") == 0)
 #define IS_EXTERN_NOINLINE(f) (DECL_EXTERNAL(f) && \
+           !lookup_attribute ("always_inline", DECL_ATTRIBUTES (f)) && \
            (!DECL_EXPLICIT_INLINE_P(f) || \
             lookup_attribute ("weak", DECL_ATTRIBUTES (f)) || \
             strcmp (lang_hooks.name, "GNU C") != 0))

Modified: llvm-gcc-4.2/trunk/gcc/cp/semantics.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/semantics.c?rev=103572&r1=103571&r2=103572&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/semantics.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/semantics.c Wed May 12 00:02:13 2010
@@ -3238,7 +3238,10 @@
      `-fexternal-templates'; we instantiate the function, even though
      we're not planning on emitting it, in case we get a chance to
      inline it.  */
-  if (DECL_EXTERNAL (fn))
+  /* LLVM LOCAL begin  always_inline functions need to be emitted */
+  if (DECL_EXTERNAL (fn) &&
+      !lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)))
+  /* LLVM LOCAL end */
     return;
 
   /* ??? When is this needed?  */





More information about the llvm-commits mailing list