diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b4dd302fe60..7cc405127af 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2012-11-06 Richard Henderson + + * tree-ssa-tail-merge.c (find_duplicate): Do not consider + is_tm_ending_fndecl calls as mergable. + 2012-11-06 Sterling Augustine Cary Coutant diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c index f9dc8806439..1521badebf8 100644 --- a/gcc/tree-ssa-tail-merge.c +++ b/gcc/tree-ssa-tail-merge.c @@ -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);