[PATCH] Factor out gimple_dont_merge_p

Tom de Vries Tom_deVries@mentor.com
Wed Nov 13 13:07:00 GMT 2013


On 11-11-13 10:37, Richard Biener wrote:
> On Sat, 9 Nov 2013, Tom de Vries wrote:
>
>> Richard,
>>
>> This patch factors out gimple_dont_merge_p from gimple_equal_p and
>> find_duplicate.
>>
>> Bootstrapped and regtested on x86_64.
>>
>> OK for trunk?
>
> +static bool
> +gimple_dont_merge_p (gimple stmt)
> +{
> +  switch (gimple_code (stmt))
> +    {
> +    case GIMPLE_CALL:
> +      /* 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 (stmt, BUILT_IN_TM_COMMIT))
> +       return true;
> +
> +      /* We cannot tail-merge the builtins that end transactions.
> +        ??? The alternative being unsharing of BBs in the tm_init pass.
> */
> +      if (flag_tm
> +         && (gimple_call_flags (stmt) & ECF_TM_BUILTIN)
> +         && is_tm_ending_fndecl (gimple_call_fndecl (stmt)))
> +       return true;
>
>
> 1) BUILT_IN_TM_COMMIT is handled in is_tm_ending_fndecl,
> 2) fndecl may be NULL
>
> I'd simply get rid of gimple_dont_merge_p and call a
> is_tm_ending (gimple) function you'd add to TM.
>

Richard,

I've update the patch according to comments, bootstrapped and reg-tested.

OK for trunk?

Thanks,
- Tom

2013-11-06  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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: tail-merge-is_tm_ending.patch
Type: text/x-patch
Size: 2656 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20131113/0bedf861/attachment.bin>


More information about the Gcc-patches mailing list