From: Richard Biener Date: Thu, 23 Jul 2015 14:31:44 +0000 (+0000) Subject: generic-match-head.c: Include cgraph.h. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d057c8669b2ca758096697826647bdc06f77c336;p=gcc.git generic-match-head.c: Include cgraph.h. 2015-07-23 Richard Biener * generic-match-head.c: Include cgraph.h. * gimple-match-head.c: Likewise. * tree-ssa-sccvn.c (free_scc_vn): Guard against newly created SSA names. * fold-const.c (fold_binary_loc): Move &A ==/!= &B simplification... * match.pd: ...to a pattern here. Add &A ==/!= 0 simplification pattern. From-SVN: r226111 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f5bb227c338..cc07d768c12 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2015-07-23 Richard Biener + + * generic-match-head.c: Include cgraph.h. + * gimple-match-head.c: Likewise. + * tree-ssa-sccvn.c (free_scc_vn): Guard against newly created + SSA names. + * fold-const.c (fold_binary_loc): Move &A ==/!= &B simplification... + * match.pd: ...to a pattern here. Add &A ==/!= 0 simplification + pattern. + 2015-07-23 Richard Biener * gimple-fold.c (fold_gimple_cond): Do not require folding diff --git a/gcc/fold-const.c b/gcc/fold-const.c index fa321f455d2..886922fcbcf 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -11082,29 +11082,6 @@ fold_binary_loc (location_t loc, && code == NE_EXPR) return non_lvalue_loc (loc, fold_convert_loc (loc, type, arg0)); - /* If this is an equality comparison of the address of two non-weak, - unaliased symbols neither of which are extern (since we do not - have access to attributes for externs), then we know the result. */ - if (TREE_CODE (arg0) == ADDR_EXPR - && DECL_P (TREE_OPERAND (arg0, 0)) - && TREE_CODE (arg1) == ADDR_EXPR - && DECL_P (TREE_OPERAND (arg1, 0))) - { - int equal; - - if (decl_in_symtab_p (TREE_OPERAND (arg0, 0)) - && decl_in_symtab_p (TREE_OPERAND (arg1, 0))) - equal = symtab_node::get_create (TREE_OPERAND (arg0, 0)) - ->equal_address_to (symtab_node::get_create - (TREE_OPERAND (arg1, 0))); - else - equal = TREE_OPERAND (arg0, 0) == TREE_OPERAND (arg1, 0); - if (equal != 2) - return constant_boolean_node (equal - ? code == EQ_EXPR : code != EQ_EXPR, - type); - } - /* Similarly for a BIT_XOR_EXPR; X ^ C1 == C2 is X == (C1 ^ C2). */ if (TREE_CODE (arg0) == BIT_XOR_EXPR && TREE_CODE (arg1) == INTEGER_CST diff --git a/gcc/generic-match-head.c b/gcc/generic-match-head.c index da7abc66964..0a7038dfc86 100644 --- a/gcc/generic-match-head.c +++ b/gcc/generic-match-head.c @@ -46,8 +46,10 @@ along with GCC; see the file COPYING3. If not see #include "builtins.h" #include "dumpfile.h" #include "target.h" +#include "cgraph.h" #include "generic-match.h" + /* Routine to determine if the types T1 and T2 are effectively the same for GENERIC. If T1 or T2 is not a type, the test applies to their TREE_TYPE. */ diff --git a/gcc/gimple-match-head.c b/gcc/gimple-match-head.c index 2b1423806bc..2c66dccb260 100644 --- a/gcc/gimple-match-head.c +++ b/gcc/gimple-match-head.c @@ -46,6 +46,7 @@ along with GCC; see the file COPYING3. If not see #include "builtins.h" #include "dumpfile.h" #include "target.h" +#include "cgraph.h" #include "gimple-match.h" diff --git a/gcc/match.pd b/gcc/match.pd index 9cf02783c46..9c181f6e142 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1754,7 +1754,28 @@ along with GCC; see the file COPYING3. If not see (simplify (cmp (convert?@3 (bit_xor @0 INTEGER_CST@1)) INTEGER_CST@2) (if (tree_nop_conversion_p (TREE_TYPE (@3), TREE_TYPE (@0))) - (cmp @0 (bit_xor @1 (convert @2)))))) + (cmp @0 (bit_xor @1 (convert @2))))) + + /* If this is an equality comparison of the address of two non-weak, + unaliased symbols neither of which are extern (since we do not + have access to attributes for externs), then we know the result. */ + (simplify + (cmp (convert? addr@0) (convert? addr@1)) + (if (decl_in_symtab_p (TREE_OPERAND (@0, 0)) + && decl_in_symtab_p (TREE_OPERAND (@1, 0))) + (with + { + int equal = symtab_node::get_create (TREE_OPERAND (@0, 0)) + ->equal_address_to (symtab_node::get_create (TREE_OPERAND (@1, 0))); + } + (if (equal != 2) + { constant_boolean_node (equal ? cmp == EQ_EXPR : cmp != EQ_EXPR, type); })))) + + (simplify + (cmp (convert? addr@0) integer_zerop) + (if (tree_single_nonzero_warnv_p (@0, NULL)) + { constant_boolean_node (cmp == NE_EXPR, type); }))) + /* bool_var != 0 becomes bool_var. */ (simplify diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index c20f1cc94bf..ab4b1100b8c 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -4223,6 +4223,8 @@ free_scc_vn (void) { tree name = ssa_name (i); if (name + && SSA_NAME_VERSION (name) < vn_ssa_aux_table.length () + && vn_ssa_aux_table[SSA_NAME_VERSION (name)] && VN_INFO (name)->needs_insertion) release_ssa_name (name); }