]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Prevent "illegal" block sharing within transactions.
authorRichard Henderson <rth@redhat.com>
Tue, 6 Nov 2012 23:55:11 +0000 (15:55 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Tue, 6 Nov 2012 23:55:11 +0000 (15:55 -0800)
        * tree-ssa-tail-merge.c (find_duplicate): Do not consider
        is_tm_ending_fndecl calls as mergable.

From-SVN: r193268

gcc/ChangeLog
gcc/tree-ssa-tail-merge.c

index b4dd302fe6028b7bafd000b1db3de894d81838b2..7cc405127af4c99a6e8eddbab7f390a666518357 100644 (file)
@@ -1,3 +1,8 @@
+2012-11-06  Richard Henderson  <rth@redhat.com>
+
+       * tree-ssa-tail-merge.c (find_duplicate): Do not consider
+       is_tm_ending_fndecl calls as mergable.
+
 2012-11-06  Sterling Augustine <saugustine@google.com>
             Cary Coutant <ccoutant@google.com>
 
index f9dc88064399d1ca04179ff3c4b1fc1f5a0eaa88..1521badebf85390272905cecd5787473d268939c 100644 (file)
@@ -1213,7 +1213,18 @@ find_duplicate (same_succ same_succ, basic_block bb1, basic_block bb2)
 
   while (!gsi_end_p (gsi1) && !gsi_end_p (gsi2))
     {
-      if (!gimple_equal_p (same_succ, gsi_stmt (gsi1), gsi_stmt (gsi2)))
+      gimple stmt1 = gsi_stmt (gsi1);
+      gimple stmt2 = gsi_stmt (gsi2);
+
+      if (!gimple_equal_p (same_succ, stmt1, stmt2))
+       return;
+
+      // We cannot tail-merge the builtins that end transactions.
+      // ??? The alternative being unsharing of BBs in the tm_init pass.
+      if (flag_tm
+         && is_gimple_call (stmt1)
+         && (gimple_call_flags (stmt1) & ECF_TM_BUILTIN)
+         && is_tm_ending_fndecl (gimple_call_fndecl (stmt1)))
        return;
 
       gsi_prev_nondebug (&gsi1);