Commit 115340c7 by Richard Guenther Committed by Richard Biener

re PR target/36713 (r137252 breaks -O2 optimization on x86_64-unknown-linux-gnu)

2008-07-07  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/36713
	* tree-flow-inline.h (is_call_used): New function.
	* tree-nrv.c (dest_safe_for_nrv_p): Use it.
	* tree-tailcall.c (suitable_for_tail_opt_p): Likewise.
	* tree-outof-ssa.c (create_temp): Set call-used flag if required.

From-SVN: r137571
parent 511e41e5
2008-07-07 Richard Guenther <rguenther@suse.de>
PR tree-optimization/36713
* tree-flow-inline.h (is_call_used): New function.
* tree-nrv.c (dest_safe_for_nrv_p): Use it.
* tree-tailcall.c (suitable_for_tail_opt_p): Likewise.
* tree-outof-ssa.c (create_temp): Set call-used flag if required.
2008-07-07 Maxim Kuvyrkov <maxim@codesourcery.com> 2008-07-07 Maxim Kuvyrkov <maxim@codesourcery.com>
* config/m68k/m68k.c (m68k_return_in_memory): Fix arguments types. * config/m68k/m68k.c (m68k_return_in_memory): Fix arguments types.
......
...@@ -881,7 +881,15 @@ factoring_name_p (const_tree name) ...@@ -881,7 +881,15 @@ factoring_name_p (const_tree name)
return TREE_CODE (SSA_NAME_VAR (name)) == MEMORY_PARTITION_TAG; return TREE_CODE (SSA_NAME_VAR (name)) == MEMORY_PARTITION_TAG;
} }
/* Return true if VAR is a clobbered by function calls. */ /* Return true if VAR is used by function calls. */
static inline bool
is_call_used (const_tree var)
{
return (var_ann (var)->call_clobbered
|| bitmap_bit_p (gimple_call_used_vars (cfun), DECL_UID (var)));
}
/* Return true if VAR is clobbered by function calls. */
static inline bool static inline bool
is_call_clobbered (const_tree var) is_call_clobbered (const_tree var)
{ {
......
...@@ -265,7 +265,7 @@ dest_safe_for_nrv_p (tree dest) ...@@ -265,7 +265,7 @@ dest_safe_for_nrv_p (tree dest)
if (TREE_CODE (dest) == SSA_NAME) if (TREE_CODE (dest) == SSA_NAME)
dest = SSA_NAME_VAR (dest); dest = SSA_NAME_VAR (dest);
if (is_call_clobbered (dest)) if (is_call_used (dest))
return false; return false;
return true; return true;
......
...@@ -128,6 +128,8 @@ create_temp (tree t) ...@@ -128,6 +128,8 @@ create_temp (tree t)
set_symbol_mem_tag (tmp, symbol_mem_tag (t)); set_symbol_mem_tag (tmp, symbol_mem_tag (t));
if (is_call_clobbered (t)) if (is_call_clobbered (t))
mark_call_clobbered (tmp, var_ann (t)->escape_mask); mark_call_clobbered (tmp, var_ann (t)->escape_mask);
if (bitmap_bit_p (gimple_call_used_vars (cfun), DECL_UID (t)))
bitmap_set_bit (gimple_call_used_vars (cfun), DECL_UID (tmp));
return tmp; return tmp;
} }
......
...@@ -138,14 +138,14 @@ suitable_for_tail_opt_p (void) ...@@ -138,14 +138,14 @@ suitable_for_tail_opt_p (void)
if (cfun->stdarg) if (cfun->stdarg)
return false; return false;
/* No local variable nor structure field should be call-clobbered. We /* No local variable nor structure field should be call-used. We
ignore any kind of memory tag, as these are not real variables. */ ignore any kind of memory tag, as these are not real variables. */
FOR_EACH_REFERENCED_VAR (var, rvi) FOR_EACH_REFERENCED_VAR (var, rvi)
{ {
if (!is_global_var (var) if (!is_global_var (var)
&& !MTAG_P (var) && !MTAG_P (var)
&& (gimple_aliases_computed_p (cfun) ? is_call_clobbered (var) && (gimple_aliases_computed_p (cfun)? is_call_used (var)
: TREE_ADDRESSABLE (var))) : TREE_ADDRESSABLE (var)))
return false; return false;
} }
......
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