Message ID | Pine.LNX.4.64.1111211625070.26507@wotan.suse.de |
---|---|
State | New |
Headers | show |
On 11/21/2011 07:42 AM, Michael Matz wrote: > __transaction_atomic > { > { > struct shared_count sc; > try > // ctor(&sc), dtor(&sc) > finally > { > sc = {CLOBBER}; > } > } > } > > later lowered to: > > <bb 3>: > __transaction_atomic // SUBCODE=[ GTMA_HAVE_STORE ] > <bb 4>: > // ctor(&sc),dtor(&sc) [tm-clone] > goto <bb 7>; > > <bb 7>: > sc ={v} {CLOBBER}; > __builtin__ITM_commitTransaction (); > > <bb 8>: > return 0; > > <L4>: > landing-pad > > The object 'sc' is constructed on the stack. Is it necessary to make it > transact? If not, then you can possibly improve code quality somewhat by > ignoring the clobbers also in requires_barrier (which then would need > changes to receive the whole statement, not just the lhs/rhs to determine > if this is an ignorable statement). I haven't tried this, though. The > patch below would be necessary anyway. No, SC need not transact because it is already transaction-local. > PR other/51125 > * trans-mem.c (expand_block_tm): Ignore clobbers. Ok. r~
Index: trans-mem.c =================================================================== --- trans-mem.c (revision 181582) +++ trans-mem.c (working copy) @@ -2319,7 +2319,8 @@ expand_block_tm (struct tm_region *regio { case GIMPLE_ASSIGN: /* Only memory reads/writes need to be instrumented. */ - if (gimple_assign_single_p (stmt)) + if (gimple_assign_single_p (stmt) + && !gimple_clobber_p (stmt)) { expand_assign_tm (region, &gsi); continue;