Commit d5ae1c25 by Tom de Vries Committed by Tom de Vries

Add is_tm_ending

2013-11-14  Tom de Vries  <tom@codesourcery.com>

	* trans-mem.c (is_tm_ending): New function.
	* gimple.h (is_tm_ending): Declare.
	* tree-ssa-tail-merge.c (gimple_equal_p): Remove test on
	BUILT_IN_TM_COMMIT.
	(find_duplicate): Use is_tm_ending instead of is_tm_ending_fndecl.

From-SVN: r204765
parent 2f1aee04
2013-11-14 Tom de Vries <tom@codesourcery.com> 2013-11-14 Tom de Vries <tom@codesourcery.com>
* trans-mem.c (is_tm_ending): New function.
* gimple.h (is_tm_ending): Declare.
* tree-ssa-tail-merge.c (gimple_equal_p): Remove test on
BUILT_IN_TM_COMMIT.
(find_duplicate): Use is_tm_ending instead of is_tm_ending_fndecl.
2013-11-14 Tom de Vries <tom@codesourcery.com>
* tree-ssa-tail-merge.c (gimple_equal_p): Remove equal variable. * tree-ssa-tail-merge.c (gimple_equal_p): Remove equal variable.
2013-11-13 Andrew MacLeod <amacleod@redhat,com> 2013-11-13 Andrew MacLeod <amacleod@redhat,com>
...@@ -957,6 +957,7 @@ extern bool infer_nonnull_range (gimple, tree); ...@@ -957,6 +957,7 @@ extern bool infer_nonnull_range (gimple, tree);
/* In trans-mem.c. */ /* In trans-mem.c. */
extern void diagnose_tm_safe_errors (tree); extern void diagnose_tm_safe_errors (tree);
extern void compute_transaction_bits (void); extern void compute_transaction_bits (void);
extern bool is_tm_ending (gimple);
/* In tree-nested.c. */ /* In tree-nested.c. */
extern void lower_nested_functions (tree); extern void lower_nested_functions (tree);
......
...@@ -323,6 +323,22 @@ is_tm_ending_fndecl (tree fndecl) ...@@ -323,6 +323,22 @@ is_tm_ending_fndecl (tree fndecl)
return false; return false;
} }
/* Return true if STMT is a built in function call that "ends" a
transaction. */
bool
is_tm_ending (gimple stmt)
{
tree fndecl;
if (gimple_code (stmt) != GIMPLE_CALL)
return false;
fndecl = gimple_call_fndecl (stmt);
return (fndecl != NULL_TREE
&& is_tm_ending_fndecl (fndecl));
}
/* Return true if STMT is a TM load. */ /* Return true if STMT is a TM load. */
static bool static bool
......
...@@ -1100,14 +1100,6 @@ gimple_equal_p (same_succ same_succ, gimple s1, gimple s2) ...@@ -1100,14 +1100,6 @@ gimple_equal_p (same_succ same_succ, gimple s1, gimple s2)
if (!gimple_call_same_target_p (s1, s2)) if (!gimple_call_same_target_p (s1, s2))
return false; return false;
/* Eventually, we'll significantly complicate the CFG by adding
back edges to properly model the effects of transaction restart.
For the bulk of optimization this does not matter, but what we
cannot recover from is tail merging blocks between two separate
transactions. Avoid that by making commit not match. */
if (gimple_call_builtin_p (s1, BUILT_IN_TM_COMMIT))
return false;
for (i = 0; i < gimple_call_num_args (s1); ++i) for (i = 0; i < gimple_call_num_args (s1); ++i)
{ {
t1 = gimple_call_arg (s1, i); t1 = gimple_call_arg (s1, i);
...@@ -1221,15 +1213,14 @@ find_duplicate (same_succ same_succ, basic_block bb1, basic_block bb2) ...@@ -1221,15 +1213,14 @@ find_duplicate (same_succ same_succ, basic_block bb1, basic_block bb2)
gimple stmt1 = gsi_stmt (gsi1); gimple stmt1 = gsi_stmt (gsi1);
gimple stmt2 = gsi_stmt (gsi2); gimple stmt2 = gsi_stmt (gsi2);
if (!gimple_equal_p (same_succ, stmt1, stmt2)) /* What could be better than to this this here is to blacklist the bb
containing the stmt, when encountering the stmt f.i. in
same_succ_hash. */
if (is_tm_ending (stmt1)
|| is_tm_ending (stmt2))
return; return;
// We cannot tail-merge the builtins that end transactions. if (!gimple_equal_p (same_succ, stmt1, stmt2))
// ??? 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; return;
gsi_prev_nondebug (&gsi1); gsi_prev_nondebug (&gsi1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment