[llvm-commits] [llvm-gcc-4.2] r74475 - /llvm-gcc-4.2/trunk/gcc/function.c

Bill Wendling isanbard at gmail.com
Mon Jun 29 16:42:21 PDT 2009


Author: void
Date: Mon Jun 29 18:42:21 2009
New Revision: 74475

URL: http://llvm.org/viewvc/llvm-project?rev=74475&view=rev
Log:
LLVM's optimizer does the inlining of "always_inline" functions. A function that
returns an aggregate value may not be a problem in this case. The GCC inliner
would normally inline these functions, and, if there are no more uses of said
function, remove it entirely so that it would never hit this warning.

For LLVM, check that the function is *not* marked "always_inline" before issuing
the warning.

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

Modified: llvm-gcc-4.2/trunk/gcc/function.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/function.c?rev=74475&r1=74474&r2=74475&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/function.c (original)
+++ llvm-gcc-4.2/trunk/gcc/function.c Mon Jun 29 18:42:21 2009
@@ -3985,7 +3985,13 @@
   /* LLVM LOCAL end */
   /* Warn if this value is an aggregate type,
      regardless of which calling convention we are using for it.  */
-  if (AGGREGATE_TYPE_P (TREE_TYPE (DECL_RESULT (subr))))
+  /* LLVM LOCAL begin - <rdar://problem/7011331> */
+  if (AGGREGATE_TYPE_P (TREE_TYPE (DECL_RESULT (subr)))
+#ifdef ENABLE_LLVM
+      && !lookup_attribute ("always_inline", DECL_ATTRIBUTES (subr))
+#endif
+      )
+  /* LLVM LOCAL end - <rdar://problem/7011331> */
     warning (OPT_Waggregate_return, "function returns an aggregate");
 }
 





More information about the llvm-commits mailing list