OSDN Git Service

PR middle-end/51472
authoraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 5 Jan 2012 13:36:32 +0000 (13:36 +0000)
committeraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 5 Jan 2012 13:36:32 +0000 (13:36 +0000)
        * trans-mem.c (expand_assign_tm): Handle TM_MEMMOVE loads correctly.
testsuite/
        PR middle-end/51472
        * gcc.dg/tm/memopt-6.c: Adjust regexp.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182908 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tm/memopt-6.c
gcc/trans-mem.c

index edaad12..cc91a4c 100644 (file)
 
 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>
index 25a52ba..7b85906 100644 (file)
@@ -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
index 496ce2d..810a559 100644 (file)
@@ -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" } } */
index 750f3a1..538d798 100644 (file)
@@ -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