trans-mem (collect_bb2reg): Stop scanning at irrevocable

* trans-mem (collect_bb2reg): Stop scanning at irrevocable
	* blocks.
	(get_bb_regions_instrumented): Add new traverse_clone argument and
	use it.
	(expand_regions_1): Same.
	(expand_region): Same.
	(execute_tm_mark): Pass new argument to expand_regions.
	(expand_block_edges): Pass new argument to
	get_bb_regions_instrumented.
testsuite/
	* g++.dg/tm/pr51516.C: Adjust for uninstrumented code path.
	* gcc.dg/tm/clone-1.c: New test.

From-SVN: r193633
This commit is contained in:
Aldy Hernandez 2012-11-19 18:43:40 +00:00 committed by Aldy Hernandez
parent a59a2c2116
commit b5e10eac56
5 changed files with 53 additions and 16 deletions

View File

@ -1,3 +1,14 @@
2012-11-19 Aldy Hernandez <aldyh@redhat.com>
* trans-mem (collect_bb2reg): Stop scanning at irrevocable blocks.
(get_bb_regions_instrumented): Add new traverse_clone argument and
use it.
(expand_regions_1): Same.
(expand_region): Same.
(execute_tm_mark): Pass new argument to expand_regions.
(expand_block_edges): Pass new argument to
get_bb_regions_instrumented.
2012-11-19 Sofiane Naci <sofiane.naci@arm.com> 2012-11-19 Sofiane Naci <sofiane.naci@arm.com>
* config/aarch64/aarch64.c * config/aarch64/aarch64.c

View File

@ -1,3 +1,8 @@
2012-11-19 Aldy Hernandez <aldyh@redhat.com>
* g++.dg/tm/pr51516.C: Adjust for uninstrumented code path.
* gcc.dg/tm/clone-1.c: New test.
2012-11-19 Paolo Carlini <paolo.carlini@oracle.com> 2012-11-19 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/55368 PR c++/55368

View File

@ -18,5 +18,4 @@ int main()
} }
/* { dg-final { scan-assembler-not "_ITM_getTMCloneOrIrrevocable" } } */ /* { dg-final { scan-assembler-not "_ITM_getTMCloneOrIrrevocable" } } */
/* { dg-final { scan-tree-dump-times ";; Function C::C" 1 "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */

View File

@ -0,0 +1,13 @@
/* { dg-do compile } */
/* { dg-options "-fgnu-tm -fdump-tree-tmmark" } */
int foo;
__attribute__((transaction_callable))
void cloneme()
{
foo = 666;
}
/* { dg-final { scan-tree-dump-times "ITM_WU.*foo" 1 "tmmark" } } */
/* { dg-final { cleanup-tree-dump "tmmark" } } */

View File

@ -138,7 +138,7 @@
static void *expand_regions (struct tm_region *, static void *expand_regions (struct tm_region *,
void *(*callback)(struct tm_region *, void *), void *(*callback)(struct tm_region *, void *),
void *); void *, bool);
/* Return the attributes we want to examine for X, or NULL if it's not /* Return the attributes we want to examine for X, or NULL if it's not
@ -2455,7 +2455,7 @@ collect_bb2reg (struct tm_region *region, void *data)
region->exit_blocks, region->exit_blocks,
region->irr_blocks, region->irr_blocks,
NULL, NULL,
/*stop_at_irr_p=*/false); /*stop_at_irr_p=*/true);
// We expect expand_region to perform a post-order traversal of the region // We expect expand_region to perform a post-order traversal of the region
// tree. Therefore the last region seen for any bb is the innermost. // tree. Therefore the last region seen for any bb is the innermost.
@ -2489,14 +2489,14 @@ collect_bb2reg (struct tm_region *region, void *data)
// only known instance of this block sharing. // only known instance of this block sharing.
static vec<tm_region_p> static vec<tm_region_p>
get_bb_regions_instrumented (void) get_bb_regions_instrumented (bool traverse_clones)
{ {
unsigned n = last_basic_block; unsigned n = last_basic_block;
vec<tm_region_p> ret; vec<tm_region_p> ret;
ret.create (n); ret.create (n);
ret.safe_grow_cleared (n); ret.safe_grow_cleared (n);
expand_regions (all_tm_regions, collect_bb2reg, &ret); expand_regions (all_tm_regions, collect_bb2reg, &ret, traverse_clones);
return ret; return ret;
} }
@ -2824,11 +2824,13 @@ execute_tm_mark (void)
{ {
pending_edge_inserts_p = false; pending_edge_inserts_p = false;
expand_regions (all_tm_regions, generate_tm_state, NULL); expand_regions (all_tm_regions, generate_tm_state, NULL,
/*traverse_clones=*/true);
tm_log_init (); tm_log_init ();
vec<tm_region_p> bb_regions = get_bb_regions_instrumented (); vec<tm_region_p> bb_regions
= get_bb_regions_instrumented (/*traverse_clones=*/true);
struct tm_region *r; struct tm_region *r;
unsigned i; unsigned i;
@ -2842,7 +2844,8 @@ execute_tm_mark (void)
propagate_tm_flags_out (all_tm_regions); propagate_tm_flags_out (all_tm_regions);
// Expand GIMPLE_TRANSACTIONs into calls into the runtime. // Expand GIMPLE_TRANSACTIONs into calls into the runtime.
expand_regions (all_tm_regions, expand_transaction, NULL); expand_regions (all_tm_regions, expand_transaction, NULL,
/*traverse_clones=*/false);
tm_log_emit (); tm_log_emit ();
tm_log_delete (); tm_log_delete ();
@ -2998,7 +3001,8 @@ expand_block_edges (struct tm_region *const region, basic_block bb)
static unsigned int static unsigned int
execute_tm_edges (void) execute_tm_edges (void)
{ {
vec<tm_region_p> bb_regions = get_bb_regions_instrumented (); vec<tm_region_p> bb_regions
= get_bb_regions_instrumented (/*traverse_clones=*/false);
struct tm_region *r; struct tm_region *r;
unsigned i; unsigned i;
@ -3042,15 +3046,18 @@ struct gimple_opt_pass pass_tm_edges =
/* Helper function for expand_regions. Expand REGION and recurse to /* Helper function for expand_regions. Expand REGION and recurse to
the inner region. Call CALLBACK on each region. CALLBACK returns the inner region. Call CALLBACK on each region. CALLBACK returns
NULL to continue the traversal, otherwise a non-null value which NULL to continue the traversal, otherwise a non-null value which
this function will return as well. */ this function will return as well. TRAVERSE_CLONES is true if we
should traverse transactional clones. */
static void * static void *
expand_regions_1 (struct tm_region *region, expand_regions_1 (struct tm_region *region,
void *(*callback)(struct tm_region *, void *), void *(*callback)(struct tm_region *, void *),
void *data) void *data,
bool traverse_clones)
{ {
void *retval = NULL; void *retval = NULL;
if (region->exit_blocks) if (region->exit_blocks
|| (traverse_clones && decl_is_tm_clone (current_function_decl)))
{ {
retval = callback (region, data); retval = callback (region, data);
if (retval) if (retval)
@ -3058,7 +3065,7 @@ expand_regions_1 (struct tm_region *region,
} }
if (region->inner) if (region->inner)
{ {
retval = expand_regions (region->inner, callback, data); retval = expand_regions (region->inner, callback, data, traverse_clones);
if (retval) if (retval)
return retval; return retval;
} }
@ -3068,17 +3075,19 @@ expand_regions_1 (struct tm_region *region,
/* Traverse the regions enclosed and including REGION. Execute /* Traverse the regions enclosed and including REGION. Execute
CALLBACK for each region, passing DATA. CALLBACK returns NULL to CALLBACK for each region, passing DATA. CALLBACK returns NULL to
continue the traversal, otherwise a non-null value which this continue the traversal, otherwise a non-null value which this
function will return as well. */ function will return as well. TRAVERSE_CLONES is true if we should
traverse transactional clones. */
static void * static void *
expand_regions (struct tm_region *region, expand_regions (struct tm_region *region,
void *(*callback)(struct tm_region *, void *), void *(*callback)(struct tm_region *, void *),
void *data) void *data,
bool traverse_clones)
{ {
void *retval = NULL; void *retval = NULL;
while (region) while (region)
{ {
retval = expand_regions_1 (region, callback, data); retval = expand_regions_1 (region, callback, data, traverse_clones);
if (retval) if (retval)
return retval; return retval;
region = region->next; region = region->next;