re PR middle-end/51472 (ICE: verify_gimple failed: invalid rhs for gimple memory...
authorAldy Hernandez <aldyh@redhat.com>
Thu, 5 Jan 2012 13:36:32 +0000 (13:36 +0000)
committerAldy Hernandez <aldyh@gcc.gnu.org>
Thu, 5 Jan 2012 13:36:32 +0000 (13:36 +0000)
        PR middle-end/51472
        * trans-mem.c (expand_assign_tm): Handle TM_MEMMOVE loads correctly.
testsuite/
        PR middle-end/51472
        * gcc.dg/tm/memopt-6.c: Adjust regexp.

From-SVN: r182908

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

index edaad12707e0e368b853720737173c6b02ae5e6d..cc91a4c94139266b4a3245e263e8d650bc521835 100644 (file)
        (ia64-hp-*vms*): Remove.
        * config/vms/xm-vms64.h: Delete.
 
+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.
index 25a52baf9604edc54257a7ea76e7fa4a9301038a..7b85906faf6ffdc7fbae6418e24d378d85432323 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 496ce2dd3e87d17958ec1a4af9db481df6a9e486..810a5595db1c3d2878e23aec5a06755fce8e45f8 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 750f3a186241a355f04684705a57a4d8af954edd..538d798a70dea760687aaa4a1a65b03233bb5ee0 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