summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/tm/memopt-6.c2
-rw-r--r--gcc/trans-mem.c20
4 files changed, 29 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index edaad12707e..cc91a4c9413 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -76,6 +76,11 @@
2012-01-04 Aldy Hernandez <aldyh@redhat.com>
+ PR middle-end/51472
+ * trans-mem.c (expand_assign_tm): Handle TM_MEMMOVE loads correctly.
+
+2012-01-04 Aldy Hernandez <aldyh@redhat.com>
+
* opts.c (finish_options): Remove duplicate sorry.
2012-01-04 Aldy Hernandez <aldyh@redhat.com>
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 25a52baf960..7b85906faf6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2012-01-05 Aldy Hernandez <aldyh@redhat.com>
+
+ PR middle-end/51472
+ * gcc.dg/tm/memopt-6.c: Adjust regexp.
+
2012-01-05 Richard Guenther <rguenther@suse.de>
PR lto/41576
diff --git a/gcc/testsuite/gcc.dg/tm/memopt-6.c b/gcc/testsuite/gcc.dg/tm/memopt-6.c
index 496ce2dd3e8..810a5595db1 100644
--- a/gcc/testsuite/gcc.dg/tm/memopt-6.c
+++ b/gcc/testsuite/gcc.dg/tm/memopt-6.c
@@ -17,5 +17,5 @@ int f()
return lala.x[i];
}
-/* { dg-final { scan-tree-dump-times "memmoveRtWt \\\(&lala, &lacopy" 1 "tmedge" } } */
+/* { dg-final { scan-tree-dump-times "memmoveRtWt \\\(.*, &lacopy" 1 "tmedge" } } */
/* { dg-final { cleanup-tree-dump "tmedge" } } */
diff --git a/gcc/trans-mem.c b/gcc/trans-mem.c
index 750f3a18624..538d798a70d 100644
--- a/gcc/trans-mem.c
+++ b/gcc/trans-mem.c
@@ -2174,7 +2174,7 @@ expand_assign_tm (struct tm_region *region, gimple_stmt_iterator *gsi)
}
if (!gcall)
{
- tree lhs_addr, rhs_addr;
+ tree lhs_addr, rhs_addr, tmp;
if (load_p)
transaction_subcode_ior (region, GTMA_HAVE_LOAD);
@@ -2183,13 +2183,29 @@ expand_assign_tm (struct tm_region *region, gimple_stmt_iterator *gsi)
/* ??? Figure out if there's any possible overlap between the LHS
and the RHS and if not, use MEMCPY. */
- lhs_addr = gimplify_addr (gsi, lhs);
+
+ if (load_p && is_gimple_non_addressable (lhs))
+ {
+ tmp = create_tmp_var (TREE_TYPE (lhs), NULL);
+ lhs_addr = build_fold_addr_expr (tmp);
+ }
+ else
+ {
+ tmp = NULL_TREE;
+ lhs_addr = gimplify_addr (gsi, lhs);
+ }
rhs_addr = gimplify_addr (gsi, rhs);
gcall = gimple_build_call (builtin_decl_explicit (BUILT_IN_TM_MEMMOVE),
3, lhs_addr, rhs_addr,
TYPE_SIZE_UNIT (TREE_TYPE (lhs)));
gimple_set_location (gcall, loc);
gsi_insert_before (gsi, gcall, GSI_SAME_STMT);
+
+ if (tmp)
+ {
+ gcall = gimple_build_assign (lhs, tmp);
+ gsi_insert_before (gsi, gcall, GSI_SAME_STMT);
+ }
}
/* Now that we have the load/store in its instrumented form, add