Commit 13261557 by Jan Hubicka

re PR lto/61886 (LTO breaks fread with _FORTIFY_SOURCE=2)


	PR ipa/61886
	PR middle-end/25140
	* ipa-reference.c (ipa_reference_get_not_read_global,
	ipa_reference_get_not_read_global): Fix WRT aliases.
	(is_improper): Break out from ...
	(is_proper_for_analysis): ... here; fix WRT aliases.
	(analyze_function, generate_summary,
	ipa_reference_write_optimization_summary,
	ipa_reference_read_optimization_summary): Use ipa_reference_var_uid.
	* ipa-refrence.h (ipa_reference_var_uid): New inline.
	* tree-ssa-alias.c: Revert my accidental previous commit.
	(ref_maybe_used_by_call_p_1,
	call_may_clobber_ref_p_1): Use ipa_reference_var_uid.

From-SVN: r231471
parent 0a04f2df
2015-12-08 Jan Hubicka <hubicka@ucw.cz>
PR ipa/61886
PR middle-end/25140
* ipa-reference.c (ipa_reference_get_not_read_global,
ipa_reference_get_not_read_global): Fix WRT aliases.
(is_improper): Break out from ...
(is_proper_for_analysis): ... here; fix WRT aliases.
(analyze_function, generate_summary,
ipa_reference_write_optimization_summary,
ipa_reference_read_optimization_summary): Use ipa_reference_var_uid.
* ipa-refrence.h (ipa_reference_var_uid): New inline.
* tree-ssa-alias.c: Revert my accidental previous commit.
(ref_maybe_used_by_call_p_1,
call_may_clobber_ref_p_1): Use ipa_reference_var_uid.
2015-12-09 Andreas Tobler <andreast@gcc.gnu.org> 2015-12-09 Andreas Tobler <andreast@gcc.gnu.org>
* config/rs6000/freebsd64.h: Remove the redefinition of WCHAR_TYPE. * config/rs6000/freebsd64.h: Remove the redefinition of WCHAR_TYPE.
...@@ -119,6 +135,7 @@ ...@@ -119,6 +135,7 @@
* tree-vectorizer.h (set_vinfo_for_stmt): Assert we don't * tree-vectorizer.h (set_vinfo_for_stmt): Assert we don't
overwrite an existing entry. overwrite an existing entry.
>>>>>>> .r231469
2015-12-09 Chung-Lin Tang <cltang@codesourcery.com> 2015-12-09 Chung-Lin Tang <cltang@codesourcery.com>
* c-family/c-omp.c (c_finish_oacc_wait): Remove add_stmt() call. * c-family/c-omp.c (c_finish_oacc_wait): Remove add_stmt() call.
...@@ -174,14 +174,22 @@ set_reference_optimization_summary (struct cgraph_node *node, ...@@ -174,14 +174,22 @@ set_reference_optimization_summary (struct cgraph_node *node,
bitmap bitmap
ipa_reference_get_not_read_global (struct cgraph_node *fn) ipa_reference_get_not_read_global (struct cgraph_node *fn)
{ {
if (!opt_for_fn (fn->decl, flag_ipa_reference) if (!opt_for_fn (current_function_decl, flag_ipa_reference))
|| !opt_for_fn (current_function_decl, flag_ipa_reference))
return NULL; return NULL;
enum availability avail;
struct cgraph_node *fn2 = fn->function_symbol (&avail);
ipa_reference_optimization_summary_t info = ipa_reference_optimization_summary_t info =
get_reference_optimization_summary (fn->function_symbol (NULL)); get_reference_optimization_summary (fn2);
if (info)
if (info
&& (avail >= AVAIL_AVAILABLE
|| (avail == AVAIL_INTERPOSABLE
&& flags_from_decl_or_type (fn->decl) & ECF_LEAF))
&& opt_for_fn (fn2->decl, flag_ipa_reference))
return info->statics_not_read; return info->statics_not_read;
else if (flags_from_decl_or_type (fn->decl) & ECF_LEAF) else if (avail == AVAIL_NOT_AVAILABLE
&& flags_from_decl_or_type (fn->decl) & ECF_LEAF)
return all_module_statics; return all_module_statics;
else else
return NULL; return NULL;
...@@ -195,14 +203,22 @@ ipa_reference_get_not_read_global (struct cgraph_node *fn) ...@@ -195,14 +203,22 @@ ipa_reference_get_not_read_global (struct cgraph_node *fn)
bitmap bitmap
ipa_reference_get_not_written_global (struct cgraph_node *fn) ipa_reference_get_not_written_global (struct cgraph_node *fn)
{ {
if (!opt_for_fn (fn->decl, flag_ipa_reference) if (!opt_for_fn (current_function_decl, flag_ipa_reference))
|| !opt_for_fn (current_function_decl, flag_ipa_reference))
return NULL; return NULL;
enum availability avail;
struct cgraph_node *fn2 = fn->function_symbol (&avail);
ipa_reference_optimization_summary_t info = ipa_reference_optimization_summary_t info =
get_reference_optimization_summary (fn); get_reference_optimization_summary (fn2);
if (info)
if (info
&& (avail >= AVAIL_AVAILABLE
|| (avail == AVAIL_INTERPOSABLE
&& flags_from_decl_or_type (fn->decl) & ECF_LEAF))
&& opt_for_fn (fn2->decl, flag_ipa_reference))
return info->statics_not_written; return info->statics_not_written;
else if (flags_from_decl_or_type (fn->decl) & ECF_LEAF) else if (avail == AVAIL_NOT_AVAILABLE
&& flags_from_decl_or_type (fn->decl) & ECF_LEAF)
return all_module_statics; return all_module_statics;
else else
return NULL; return NULL;
......
...@@ -1739,22 +1739,16 @@ ref_maybe_used_by_call_p_1 (gcall *call, ao_ref *ref) ...@@ -1739,22 +1739,16 @@ ref_maybe_used_by_call_p_1 (gcall *call, ao_ref *ref)
&& TREE_STATIC (base)) && TREE_STATIC (base))
{ {
struct cgraph_node *node = cgraph_node::get (callee); struct cgraph_node *node = cgraph_node::get (callee);
bitmap not_read;
/* FIXME: Callee can be an OMP builtin that does not have a call graph /* FIXME: Callee can be an OMP builtin that does not have a call graph
node yet. We should enforce that there are nodes for all decls in the node yet. We should enforce that there are nodes for all decls in the
IL and remove this check instead. */ IL and remove this check instead. */
if (node) if (node
{
enum availability avail;
bitmap not_read;
node = node->ultimate_alias_target (&avail);
if (avail >= AVAIL_AVAILABLE
&& (not_read = ipa_reference_get_not_read_global (node)) && (not_read = ipa_reference_get_not_read_global (node))
&& bitmap_bit_p (not_read, ipa_reference_var_uid (base))) && bitmap_bit_p (not_read, ipa_reference_var_uid (base)))
goto process_args; goto process_args;
} }
}
/* Check if the base variable is call-used. */ /* Check if the base variable is call-used. */
if (DECL_P (base)) if (DECL_P (base))
...@@ -2134,19 +2128,13 @@ call_may_clobber_ref_p_1 (gcall *call, ao_ref *ref) ...@@ -2134,19 +2128,13 @@ call_may_clobber_ref_p_1 (gcall *call, ao_ref *ref)
&& TREE_STATIC (base)) && TREE_STATIC (base))
{ {
struct cgraph_node *node = cgraph_node::get (callee); struct cgraph_node *node = cgraph_node::get (callee);
if (node)
{
bitmap not_written; bitmap not_written;
enum availability avail;
node = node->ultimate_alias_target (&avail); if (node
if (avail >= AVAIL_AVAILABLE
&& (not_written = ipa_reference_get_not_written_global (node)) && (not_written = ipa_reference_get_not_written_global (node))
&& bitmap_bit_p (not_written, ipa_reference_var_uid (base))) && bitmap_bit_p (not_written, ipa_reference_var_uid (base)))
return false; return false;
} }
}
/* Check if the base variable is call-clobbered. */ /* Check if the base variable is call-clobbered. */
if (DECL_P (base)) if (DECL_P (base))
......
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