aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2018-11-09 16:04:52 +0100
committerMartin Liska <marxin@gcc.gnu.org>2018-11-09 15:04:52 +0000
commit2e14744fcd7820033b91c9516e22eb42b02b5290 (patch)
treecd0f6b1d8e87c8bebf1881f75790b1da936e3006 /gcc/ipa.c
parent9ed3186036f25d9dd870cc2a02bfdf6fc31cde42 (diff)
downloadgcc-2e14744fcd7820033b91c9516e22eb42b02b5290.zip
gcc-2e14744fcd7820033b91c9516e22eb42b02b5290.tar.gz
gcc-2e14744fcd7820033b91c9516e22eb42b02b5290.tar.bz2
Come up with -fipa-reference-addressable flag.
2018-11-09 Martin Liska <mliska@suse.cz> * cgraph.h (ipa_discover_readonly_nonaddressable_vars): Rename to ... (ipa_discover_variable_flags): ... this. * common.opt: Come up with new flag -fipa-reference-addressable. * doc/invoke.texi: Document it. * ipa-reference.c (propagate): Call the renamed fn. * ipa-visibility.c (whole_program_function_and_variable_visibility): Likewise. * ipa.c (ipa_discover_readonly_nonaddressable_vars): Renamed to ... (ipa_discover_variable_flags): ... this. Discover non-addressable variables only with the newly added flag. * opts.c: Enable the newly added flag with -O1 and higher optimization level. 2018-11-09 Martin Liska <mliska@suse.cz> * gcc.dg/tree-ssa/writeonly-2.c: New test. From-SVN: r265969
Diffstat (limited to 'gcc/ipa.c')
-rw-r--r--gcc/ipa.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/ipa.c b/gcc/ipa.c
index 3b6b5e5..22c2135 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -752,10 +752,10 @@ clear_addressable_bit (varpool_node *vnode, void *data ATTRIBUTE_UNUSED)
return false;
}
-/* Discover variables that have no longer address taken or that are read only
- and update their flags.
+/* Discover variables that have no longer address taken, are read-only or
+ write-only and update their flags.
- Return true when unreachable symbol removan should be done.
+ Return true when unreachable symbol removal should be done.
FIXME: This can not be done in between gimplify and omp_expand since
readonly flag plays role on what is shared and what is not. Currently we do
@@ -764,8 +764,11 @@ clear_addressable_bit (varpool_node *vnode, void *data ATTRIBUTE_UNUSED)
make sense to do it before early optimizations. */
bool
-ipa_discover_readonly_nonaddressable_vars (void)
+ipa_discover_variable_flags (void)
{
+ if (!flag_ipa_reference_addressable)
+ return false;
+
bool remove_p = false;
varpool_node *vnode;
if (dump_file)