Patchwork trans-mem: functions making indirect calls are not transformed (issue6194061)

login
register
mail settings
Submitter Patrick Marlier
Date May 15, 2012, 9:33 p.m.
Message ID <4FB2CBBF.6020209@gmail.com>
Download mbox | patch
Permalink /patch/159459/
State New
Headers show

Comments

Patrick Marlier - May 15, 2012, 9:33 p.m.
Follow-up of Dave's patch with a testcase.
Functions with indirect calls must be transactified (transformed).

Tested on i686.
Ok for trunk?
--
Patrick

2012-05-15  Dave Boutcher  <daveboutcher@gmail.com>
             Patrick Marlier  <patrick.marlier@gmail.com>

         * trans-mem.c (ipa_tm_transform_clone): Transform functions with
         indirect calls.

2012-05-15  Patrick Marlier  <patrick.marlier@gmail.com>

         * gcc.dg/tm/indirect-2.c: New test.


On 05/08/2012 06:40 PM, Dave Boutcher wrote:
>   gcc/trans-mem.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
> index 2badf25..24073fa 100644
> --- a/gcc/trans-mem.c
> +++ b/gcc/trans-mem.c
> @@ -4721,7 +4721,7 @@ ipa_tm_transform_clone (struct cgraph_node *node)
>     /* If this function makes no calls and has no irrevocable blocks,
>        then there's nothing to do.  */
>     /* ??? Remove non-aborting top-level transactions.  */
> -  if (!node->callees&&  !d->irrevocable_blocks_clone)
> +  if (!node->callees&&  !node->indirect_calls&&  !d->irrevocable_blocks_clone)
>       return;
>
>     current_function_decl = d->clone->decl;
Richard Henderson - May 16, 2012, 4:23 p.m.
On 05/15/2012 02:33 PM, Patrick Marlier wrote:
> 2012-05-15  Dave Boutcher <daveboutcher@gmail.com>
>              Patrick Marlier <patrick.marlier@gmail.com>
>
>          * trans-mem.c (ipa_tm_transform_clone): Transform functions with
>          indirect calls.
>
> 2012-05-15  Patrick Marlier <patrick.marlier@gmail.com>
>
>          * gcc.dg/tm/indirect-2.c: New test.

Ok for trunk and branch (if applicable).


r~

Patch

Index: testsuite/gcc.dg/tm/indirect-2.c
===================================================================
--- testsuite/gcc.dg/tm/indirect-2.c	(revision 0)
+++ testsuite/gcc.dg/tm/indirect-2.c	(revision 0)
@@ -0,0 +1,15 @@ 
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+void __attribute__((transaction_safe))
+foo(void);
+
+void __attribute__((transaction_safe))
+set_fn(void)
+{
+  void __attribute__((transaction_safe)) (*fn)(void);
+  fn = foo;
+  fn();
+}
+
+/* { dg-final { scan-assembler "_ITM_getTMCloneSafe" } } */
Index: trans-mem.c
===================================================================
--- trans-mem.c	(revision 187371)
+++ trans-mem.c	(working copy)
@@ -4732,7 +4732,7 @@  ipa_tm_transform_clone (struct cgraph_node *node)
   /* If this function makes no calls and has no irrevocable blocks,
      then there's nothing to do.  */
   /* ??? Remove non-aborting top-level transactions.  */
-  if (!node->callees && !d->irrevocable_blocks_clone)
+  if (!node->callees && !node->indirect_calls && !d->irrevocable_blocks_clone)
     return;
 
   current_function_decl = d->clone->symbol.decl;