From patchwork Thu Feb 24 19:01:43 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [trans-mem] PR47606: Add a tm-safe marker for GIMPLE_ASM's Date: Thu, 24 Feb 2011 09:01:43 -0000 From: Aldy Hernandez X-Patchwork-Id: 84447 Message-Id: <4D66AB17.9040807@redhat.com> To: Richard Henderson Cc: Patrick MARLIER , gcc-patches > 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. 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;