aboutsummaryrefslogtreecommitdiff
path: root/gcc/trans-mem.c
diff options
context:
space:
mode:
authorAldy Hernandez <aldyh@redhat.com>2012-02-28 20:08:39 +0000
committerAldy Hernandez <aldyh@gcc.gnu.org>2012-02-28 20:08:39 +0000
commit19c0d7df9931c87307ca1eaae37b266e249b39d7 (patch)
tree780606e8e39dbc758d4c2e3c28e49951fa7b82fc /gcc/trans-mem.c
parentca45d3d56d8760eb36b8cf04cf8c89f01e03d93c (diff)
downloadgcc-19c0d7df9931c87307ca1eaae37b266e249b39d7.zip
gcc-19c0d7df9931c87307ca1eaae37b266e249b39d7.tar.gz
gcc-19c0d7df9931c87307ca1eaae37b266e249b39d7.tar.bz2
re PR middle-end/51752 (trans-mem: publication safety violated)
PR middle-end/51752 * gimple.h (gimple_in_transaction): New. (gimple_set_in_transaction): New. (struct gimple_statement_base): Add in_transaction field. * tree-ssa-loop-im.c: (movement_possibility): Restrict movement of transaction loads. (tree_ssa_lim_initialize): Compute transaction bits. * tree.h (compute_transaction_bits): Protoize. * trans-mem.c (tm_region_init): Use the heap to store BB auxilliary data. (compute_transaction_bits): New. From-SVN: r184638
Diffstat (limited to 'gcc/trans-mem.c')
-rw-r--r--gcc/trans-mem.c57
1 files changed, 50 insertions, 7 deletions
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index aa330dd..56ef72e 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -1858,18 +1858,25 @@ tm_region_init (struct tm_region *region)
VEC(basic_block, heap) *queue = NULL;
bitmap visited_blocks = BITMAP_ALLOC (NULL);
struct tm_region *old_region;
+ struct tm_region **region_worklist;
all_tm_regions = region;
bb = single_succ (ENTRY_BLOCK_PTR);
+ /* We could store this information in bb->aux, but we may get called
+ through get_all_tm_blocks() from another pass that may be already
+ using bb->aux. */
+ region_worklist =
+ (struct tm_region **) xcalloc (sizeof (struct tm_region *),
+ n_basic_blocks + NUM_FIXED_BLOCKS + 2);
+
VEC_safe_push (basic_block, heap, queue, bb);
- gcc_assert (!bb->aux); /* FIXME: Remove me. */
- bb->aux = region;
+ region_worklist[bb->index] = region;
do
{
bb = VEC_pop (basic_block, queue);
- region = (struct tm_region *)bb->aux;
- bb->aux = NULL;
+ region = region_worklist[bb->index];
+ region_worklist[bb->index] = NULL;
/* Record exit and irrevocable blocks. */
region = tm_region_init_1 (region, bb);
@@ -1886,20 +1893,20 @@ tm_region_init (struct tm_region *region)
{
bitmap_set_bit (visited_blocks, e->dest->index);
VEC_safe_push (basic_block, heap, queue, e->dest);
- gcc_assert (!e->dest->aux); /* FIXME: Remove me. */
/* If the current block started a new region, make sure that only
the entry block of the new region is associated with this region.
Other successors are still part of the old region. */
if (old_region != region && e->dest != region->entry_block)
- e->dest->aux = old_region;
+ region_worklist[e->dest->index] = old_region;
else
- e->dest->aux = region;
+ region_worklist[e->dest->index] = region;
}
}
while (!VEC_empty (basic_block, queue));
VEC_free (basic_block, heap, queue);
BITMAP_FREE (visited_blocks);
+ free (region_worklist);
}
/* The "gate" function for all transactional memory expansion and optimization
@@ -2424,6 +2431,42 @@ get_tm_region_blocks (basic_block entry_block,
return bbs;
}
+/* Set the IN_TRANSACTION for all gimple statements that appear in a
+ transaction. */
+
+void
+compute_transaction_bits (void)
+{
+ struct tm_region *region;
+ VEC (basic_block, heap) *queue;
+ unsigned int i;
+ gimple_stmt_iterator gsi;
+ basic_block bb;
+
+ /* ?? Perhaps we need to abstract gate_tm_init further, because we
+ certainly don't need it to calculate CDI_DOMINATOR info. */
+ gate_tm_init ();
+
+ for (region = all_tm_regions; region; region = region->next)
+ {
+ queue = get_tm_region_blocks (region->entry_block,
+ region->exit_blocks,
+ region->irr_blocks,
+ NULL,
+ /*stop_at_irr_p=*/true);
+ for (i = 0; VEC_iterate (basic_block, queue, i, bb); ++i)
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ {
+ gimple stmt = gsi_stmt (gsi);
+ gimple_set_in_transaction (stmt, true);
+ }
+ VEC_free (basic_block, heap, queue);
+ }
+
+ if (all_tm_regions)
+ bitmap_obstack_release (&tm_obstack);
+}
+
/* Entry point to the MARK phase of TM expansion. Here we replace
transactional memory statements with calls to builtins, and function
calls with their transactional clones (if available). But we don't