diff options
author | Jan Hubicka <jh@suse.cz> | 2010-09-20 17:48:42 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2010-09-20 15:48:42 +0000 |
commit | 64e0f5ff1f3be1ddccc2a50cb371b5dce94124b1 (patch) | |
tree | 5dc2da773507a107b478346e98a80752893d9599 /gcc/expr.c | |
parent | 4ce9b2b20f34a82792df7e5dbb8c230e1cc29e45 (diff) | |
download | gcc-64e0f5ff1f3be1ddccc2a50cb371b5dce94124b1.zip gcc-64e0f5ff1f3be1ddccc2a50cb371b5dce94124b1.tar.gz gcc-64e0f5ff1f3be1ddccc2a50cb371b5dce94124b1.tar.bz2 |
re PR tree-optimization/45605 (Missed devirtualization)
PR tree-optimize/45605
* cgraph.h (const_value_known_p): Declare.
(varpool_decide_const_value_known): Remove.
* tree-ssa-ccp.c (get_base_constructor): Use it.
* lto-cgraph.c (compute_ltrans_boundary): Likewise.
* expr.c (string_constant): Likewise.
* tree-ssa-loop-ivcanon.c (constant_after_peeling): Likewise.
* ipa.c (ipa_discover_readonly_nonaddressable_var,
function_and_variable_visibility): Likewise.
* gimplify.c (gimplify_call_expr): Likewise.
* gimple-fold.c (get_symbol_constant_value): Likewise.
* varpool.c (varpool_decide_const_value_known): Replace by...
(const_value_known_p): ... this one; handle other kinds of DECLs
too and work for automatic vars.
(varpool_finalize_decl): Use const_value_known_p.
* lto.c (lto_promote_cross_file_statics): Use const_value_known_p.
* g++.dg/tree-ssa/pr45605.C: New testcase.
From-SVN: r164438
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 8 |
1 files changed, 1 insertions, 7 deletions
@@ -9851,16 +9851,10 @@ string_constant (tree arg, tree *ptr_offset) int length; /* Variables initialized to string literals can be handled too. */ - if (DECL_INITIAL (array) == NULL_TREE + if (!const_value_known_p (array) || TREE_CODE (DECL_INITIAL (array)) != STRING_CST) return 0; - /* If they are read-only, non-volatile and bind locally. */ - if (! TREE_READONLY (array) - || TREE_SIDE_EFFECTS (array) - || ! targetm.binds_local_p (array)) - return 0; - /* Avoid const char foo[4] = "abcde"; */ if (DECL_SIZE_UNIT (array) == NULL_TREE || TREE_CODE (DECL_SIZE_UNIT (array)) != INTEGER_CST |