diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2015-12-09 08:34:16 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2015-12-09 07:34:16 +0000 |
commit | 37074a02aee862ae15867e40aa5a12db616657b6 (patch) | |
tree | a589b3f752ddc9ef0c99801a8a2355889655a259 /gcc/tree-ssa-alias.c | |
parent | 04d2fbcc5fa0a0464e847d1bf3faeb83d67711c2 (diff) | |
download | gcc-37074a02aee862ae15867e40aa5a12db616657b6.zip gcc-37074a02aee862ae15867e40aa5a12db616657b6.tar.gz gcc-37074a02aee862ae15867e40aa5a12db616657b6.tar.bz2 |
re PR lto/61886 (LTO breaks fread with _FORTIFY_SOURCE=2)
PR ipa/61886
PR middle-end/25140
* ipa-reference.c (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 (ref_maybe_used_by_call_p_1,
call_may_clobber_ref_p_1): Use ipa_reference_var_uid.
* gcc.c-torture/execute/alias-3.c: New testcase.
From-SVN: r231442
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r-- | gcc/tree-ssa-alias.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index e1d9cda..c859e3f 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -1739,15 +1739,21 @@ ref_maybe_used_by_call_p_1 (gcall *call, ao_ref *ref) && TREE_STATIC (base)) { 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 node yet. We should enforce that there are nodes for all decls in the IL and remove this check instead. */ - if (node - && (not_read = ipa_reference_get_not_read_global (node)) - && bitmap_bit_p (not_read, DECL_UID (base))) - goto process_args; + 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)) + && bitmap_bit_p (not_read, ipa_reference_var_uid (base))) + goto process_args; + } } /* Check if the base variable is call-used. */ @@ -2128,12 +2134,18 @@ call_may_clobber_ref_p_1 (gcall *call, ao_ref *ref) && TREE_STATIC (base)) { struct cgraph_node *node = cgraph_node::get (callee); - bitmap not_written; - if (node - && (not_written = ipa_reference_get_not_written_global (node)) - && bitmap_bit_p (not_written, DECL_UID (base))) - return false; + if (node) + { + bitmap not_written; + enum availability avail; + + node = node->ultimate_alias_target (&avail); + if (avail >= AVAIL_AVAILABLE + && (not_written = ipa_reference_get_not_written_global (node)) + && bitmap_bit_p (not_written, ipa_reference_var_uid (base))) + return false; + } } /* Check if the base variable is call-clobbered. */ |