diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-09-03 10:15:54 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-09-03 10:15:54 +0000 |
commit | 9d924a14cb3657941ca4f1406f1b710fec343aec (patch) | |
tree | 557b00c4e086e7d798393273321f3907a7d16cb4 /gcc/ipa.c | |
parent | bf0e72b2492b09bb9be1c0aa55a6991dec33f374 (diff) | |
download | gcc-9d924a14cb3657941ca4f1406f1b710fec343aec.tar.gz |
* cgraph.h (struct varpool_node): Add const_value_known.
(varpool_decide_const_value_known): Declare.
* tree-ssa-ccp.c (fold_const_aggregate_ref): Update initializer folding.
* lto-cgraph.c (lto_output_varpool_node): Store const_value_known.
(input_varpool_node): Restore const_value_known.
* tree-ssa-loop-ivcanon (constant_after_peeling): Check varpool for
initializer folding.
* ipa.c (ipa_discover_readonly_nonaddressable_var,
function_and_variable_visibility): Compute const_value_known.
* gimple-fold.c (get_symbol_constant_value): Use varpool for initializer
folding.
* varpool.c (varpool_decide_const_value_known): New function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163808 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa.c')
-rw-r--r-- | gcc/ipa.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/ipa.c b/gcc/ipa.c index 021398b6748..b199796fcdb 100644 --- a/gcc/ipa.c +++ b/gcc/ipa.c @@ -561,6 +561,7 @@ ipa_discover_readonly_nonaddressable_vars (void) if (dump_file) fprintf (dump_file, " %s (read-only)", varpool_node_name (vnode)); TREE_READONLY (vnode->decl) = 1; + vnode->const_value_known |= varpool_decide_const_value_known (vnode); } } if (dump_file) @@ -767,6 +768,9 @@ function_and_variable_visibility (bool whole_program) || ! (ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (TREE_TYPE (vnode->decl)))))) DECL_COMMON (vnode->decl) = 0; + /* Even extern variables might have initializers known. + See, for example testsuite/g++.dg/opt/static3.C */ + vnode->const_value_known |= varpool_decide_const_value_known (vnode); } for (vnode = varpool_nodes_queue; vnode; vnode = vnode->next_needed) { @@ -801,6 +805,7 @@ function_and_variable_visibility (bool whole_program) gcc_assert (in_lto_p || whole_program || !TREE_PUBLIC (vnode->decl)); cgraph_make_decl_local (vnode->decl); } + vnode->const_value_known |= varpool_decide_const_value_known (vnode); gcc_assert (TREE_STATIC (vnode->decl)); } pointer_set_destroy (aliased_nodes); |