diff options
author | Jan Hubicka <jh@suse.cz> | 2013-06-19 20:06:12 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2013-06-19 18:06:12 +0000 |
commit | 6a6dac5293ee21d9aed0d394a0cb23948bb1efad (patch) | |
tree | 1d4237222ae0ad0d8207eb6ee9f94b244ffae6e5 /gcc/gimple-fold.c | |
parent | 216c12abf6eccbcf5c5ff1898e8b063a494af40c (diff) | |
download | gcc-6a6dac5293ee21d9aed0d394a0cb23948bb1efad.zip gcc-6a6dac5293ee21d9aed0d394a0cb23948bb1efad.tar.gz gcc-6a6dac5293ee21d9aed0d394a0cb23948bb1efad.tar.bz2 |
cgraph.h (const_value_known_p): Replace by ...
* cgraph.h (const_value_known_p): Replace by ...
(ctor_for_folding): .. this one.
* cgraphunit.c (process_function_and_variable_attributes): Use it.
* lto-cgraph.c (compute_ltrans_boundary): Use ctor_for_folding.
* expr.c (expand_expr_real_1): Likewise.
(string_constant): Likewise.
* tree-ssa-loop-ivcanon.c (constant_after_peeling): Likewise.
* ipa.c (process_references): Likewise.
(symtab_remove_unreachable_nodes): Likewise.
* ipa-inline-analysis.c (param_change_prob): Likewise.
* gimple-fold.c (canonicalize_constructor_val): Likewise.
(get_base_constructor): Likwise.
* varpool.c (varpool_remove_node): Likewise.
(varpool_remove_initializer): LIkewise.
(dump_varpool_node): LIkwise.
(const_value_known_p): Rewrite to ...
(ctor_for_folding): ... this one.
* lto-partition.c (add_references_to_partition): Use
ctor_for_folding.
* gcc.dg/tree-ssa/attr-alias-2.c: New testcase.
From-SVN: r200211
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r-- | gcc/gimple-fold.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 60fca6b..b6d22b3 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -192,9 +192,9 @@ canonicalize_constructor_val (tree cval, tree from_decl) tree get_symbol_constant_value (tree sym) { - if (const_value_known_p (sym)) + tree val = ctor_for_folding (sym); + if (val != error_mark_node) { - tree val = DECL_INITIAL (sym); if (val) { val = canonicalize_constructor_val (unshare_expr (val), sym); @@ -2695,19 +2695,18 @@ get_base_constructor (tree base, HOST_WIDE_INT *bit_offset, switch (TREE_CODE (base)) { case VAR_DECL: - if (!const_value_known_p (base)) - return NULL_TREE; - - /* Fallthru. */ case CONST_DECL: - if (!DECL_INITIAL (base) - && (TREE_STATIC (base) || DECL_EXTERNAL (base))) - return error_mark_node; - /* Do not return an error_mark_node DECL_INITIAL. LTO uses this - as special marker (_not_ zero ...) for its own purposes. */ - if (DECL_INITIAL (base) == error_mark_node) - return NULL_TREE; - return DECL_INITIAL (base); + { + tree init = ctor_for_folding (base); + + /* Our semantic is exact oposite of ctor_for_folding; + NULL means unknown, while error_mark_node is 0. */ + if (init == error_mark_node) + return NULL_TREE; + if (!init) + return error_mark_node; + return init; + } case ARRAY_REF: case COMPONENT_REF: |