This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [trans-mem] do not inline wrapper functions


On Thu, Sep 10, 2009 at 10:17:40AM -0700, Richard Henderson wrote:
> On 09/10/2009 10:12 AM, Aldy Hernandez wrote:
>> The CALL_CANNOT_INLINE_P bit should be set on the CALL_EXPR, not the
>> FUNCTION_DECL, which is what we have when we parse the attribute.
>>
>> I'll try the DECL_UNINLINABLE thing Matz suggested.
>
> I think the DECL_UNINLINABLE thing won't be too bad in practice.
> I think wrappers will normally be used with external library
> functions, which couldn't be inlined anyway.

Yay!  One line change.

No regressions on tm.exp.

OK?

	* trans-mem.c (record_tm_replacement): Set DECL_UNINLINABLE.

Index: testsuite/gcc.dg/tm/wrap-4.c
===================================================================
--- testsuite/gcc.dg/tm/wrap-4.c	(revision 0)
+++ testsuite/gcc.dg/tm/wrap-4.c	(revision 0)
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -fdump-tree-optimized -O2" } */
+
+static void candy() { candycane(); }
+
+static void tootsie_roll () __attribute__((tm_wrap (candy)));
+static void tootsie_roll () { bark(); }
+
+void foo()
+{
+  __tm_atomic  candy();
+}
+
+/* { dg-final { scan-tree-dump-times "candy" 0 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
Index: trans-mem.c
===================================================================
--- trans-mem.c	(revision 151577)
+++ trans-mem.c	(working copy)
@@ -325,6 +325,7 @@ record_tm_replacement (tree from, tree t
 {
   struct tree_map **slot, *h;
 
+  DECL_UNINLINABLE (from) = 1;
   if (tm_wrap_map == NULL)
     tm_wrap_map = htab_create_ggc (32, tree_map_hash, tree_map_eq, 0);
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]