Patchwork [trans-mem] PR47606: Add a tm-safe marker for GIMPLE_ASM's

login
register
mail settings
Submitter Aldy Hernandez
Date Feb. 24, 2011, 7:01 p.m.
Message ID <4D66AB17.9040807@redhat.com>
Download mbox | patch
Permalink /patch/84447/
State New
Headers show

Comments

Aldy Hernandez - Feb. 24, 2011, 7:01 p.m.
> Which then immediately fails for one layer of indirection:

Well, this we can fix with a small change to the inliner, by propagating 
the ASM_TM_SAFE bit through the inlined copies.  See patch below.

I'm worried the tm_waiver approach will require changes to TM sources. 
But I'll gladly let you play around with it.

Thanks.
Richard Henderson - Feb. 24, 2011, 7:14 p.m.
On 02/24/2011 11:01 AM, Aldy Hernandez wrote:
> I'm worried the tm_waiver approach will require changes to TM
> sources. But I'll gladly let you play around with it.

No, I'm going to transform any call to a tm_pure function within
a transaction into __tm_waiver { pure_call(); } implicitly during
pass_lower_tm.


r~

Patch

Index: tree-inline.c
===================================================================
--- tree-inline.c	(revision 170359)
+++ tree-inline.c	(working copy)
@@ -1476,6 +1476,7 @@  copy_bb (copy_body_data *id, basic_block
   basic_block copy_basic_block;
   tree decl;
   gcov_type freq;
+  bool dst_fn_is_tm_pure = is_tm_pure (id->dst_fn);
 
   /* create_basic_block() will append every new block to
      basic_block_info automatically.  */
@@ -1504,6 +1505,9 @@  copy_bb (copy_body_data *id, basic_block
       if (gimple_nop_p (stmt))
 	continue;
 
+      if (dst_fn_is_tm_pure && gimple_code (stmt) == GIMPLE_ASM)
+	gimple_asm_set_tm_safe (stmt, true);
+
       gimple_duplicate_stmt_histograms (cfun, stmt, id->src_cfun, orig_stmt);
       seq_gsi = copy_gsi;