[llvm-commits] [llvm-gcc-4.2] r53130 - /llvm-gcc-4.2/trunk/gcc/cgraphunit.c

Dale Johannesen dalej at apple.com
Thu Jul 3 17:28:08 PDT 2008


Author: johannes
Date: Thu Jul  3 19:28:07 2008
New Revision: 53130

URL: http://llvm.org/viewvc/llvm-project?rev=53130&view=rev
Log:
Do not emit unreferenced static functions at -O0.  
This is the gcc-4.0 behavior, changed deliberately
in gcc-4.2, see PR 24561.  After discussion Chris,
Evan and I agreed the 4.0 behavior is better so
we're going back to that.

Note this applies to C++, not C by default, because
you also need -funit-at-a-time (default in C++ only).


Modified:
    llvm-gcc-4.2/trunk/gcc/cgraphunit.c

Modified: llvm-gcc-4.2/trunk/gcc/cgraphunit.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cgraphunit.c?rev=53130&r1=53129&r2=53130&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cgraphunit.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cgraphunit.c Thu Jul  3 19:28:07 2008
@@ -232,9 +232,19 @@
      in the original implementation and it is unclear whether we want
      to change the behavior here.  */
   if (((TREE_PUBLIC (decl)
+/* LLVM LOCAL begin */
+#ifndef ENABLE_LLVM
+    /* Don't keep static functions at -O0.  Note that gcc-4.0 removes such
+       functions; gcc-4.2 does not.  Radar 6037815.  See also PR 24561.
+
+       For this to be effective, -funit-at-a-time must also be on.  This
+       is the default in C++/ObjC++, but not C/ObjC.  */
 	|| (!optimize && !node->local.disregard_inline_limits
 	    && !DECL_DECLARED_INLINE_P (decl)
-	    && !node->origin))
+	    && !node->origin)
+#endif
+        )
+/* LLVM LOCAL end */
       && !flag_whole_program)
       && !DECL_COMDAT (decl) && !DECL_EXTERNAL (decl))
     return true;





More information about the llvm-commits mailing list