aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-im.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/tree-ssa-loop-im.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/tree-ssa-loop-im.c')
-rw-r--r--gcc/tree-ssa-loop-im.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 3c7bb65..ce5eb20 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -150,7 +150,7 @@ typedef struct mem_ref
bitmap indep_ref; /* The set of memory references on that
this reference is independent. */
- bitmap dep_ref; /* The complement of DEP_REF. */
+ bitmap dep_ref; /* The complement of INDEP_REF. */
} *mem_ref_p;
DEF_VEC_P(mem_ref_p);
@@ -412,6 +412,26 @@ movement_possibility (gimple stmt)
|| gimple_could_trap_p (stmt))
return MOVE_PRESERVE_EXECUTION;
+ /* Non local loads in a transaction cannot be hoisted out. Well,
+ unless the load happens on every path out of the loop, but we
+ don't take this into account yet. */
+ if (flag_tm
+ && gimple_in_transaction (stmt)
+ && gimple_assign_single_p (stmt))
+ {
+ tree rhs = gimple_assign_rhs1 (stmt);
+ if (DECL_P (rhs) && is_global_var (rhs))
+ {
+ if (dump_file)
+ {
+ fprintf (dump_file, "Cannot hoist conditional load of ");
+ print_generic_expr (dump_file, rhs, TDF_SLIM);
+ fprintf (dump_file, " because it is in a transaction.\n");
+ }
+ return MOVE_IMPOSSIBLE;
+ }
+ }
+
return ret;
}
@@ -2387,6 +2407,9 @@ tree_ssa_lim_initialize (void)
sbitmap_free (contains_call);
lim_aux_data_map = pointer_map_create ();
+
+ if (flag_tm)
+ compute_transaction_bits ();
}
/* Cleans up after the invariant motion pass. */