summaryrefslogtreecommitdiff
path: root/gcc/match.pd
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-14 12:59:15 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-14 12:59:15 +0000
commit04a37b12bbd351cd32ea592906aef2f1033253e0 (patch)
tree1c951111002e36e36791d6b8c618654105a3bdc9 /gcc/match.pd
parent389034a4ab3bc82b6feee643ddab6b130ca46388 (diff)
downloadgcc-04a37b12bbd351cd32ea592906aef2f1033253e0.tar.gz
2015-10-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/67915 * match.pd: Handle comparisons of addresses of STRING_CSTs. * gimplify.c (gimplify_cond_expr): Fold the GIMPLE conds we build. * tree-cfgcleanup.c (cleanup_control_expr_graph): Remove GENERIC stmt folding in favor of GIMPLE one. * gcc.dg/torture/pr67915.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228810 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/match.pd')
-rw-r--r--gcc/match.pd12
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/match.pd b/gcc/match.pd
index 6714796943e..655c9ffcf26 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -1998,8 +1998,12 @@ along with GCC; see the file COPYING3. If not see
&& decl_in_symtab_p (base1))
equal = symtab_node::get_create (base0)
->equal_address_to (symtab_node::get_create (base1));
- else if ((DECL_P (base0) || TREE_CODE (base0) == SSA_NAME)
- && (DECL_P (base1) || TREE_CODE (base1) == SSA_NAME))
+ else if ((DECL_P (base0)
+ || TREE_CODE (base0) == SSA_NAME
+ || TREE_CODE (base0) == STRING_CST)
+ && (DECL_P (base1)
+ || TREE_CODE (base1) == SSA_NAME
+ || TREE_CODE (base1) == STRING_CST))
equal = (base0 == base1);
}
(if (equal == 1
@@ -2007,9 +2011,9 @@ along with GCC; see the file COPYING3. If not see
/* If the offsets are equal we can ignore overflow. */
|| off0 == off1
|| POINTER_TYPE_OVERFLOW_UNDEFINED
- /* Or if we compare using pointers to decls. */
+ /* Or if we compare using pointers to decls or strings. */
|| (POINTER_TYPE_P (TREE_TYPE (@2))
- && DECL_P (base0))))
+ && (DECL_P (base0) || TREE_CODE (base0) == STRING_CST))))
(switch
(if (cmp == EQ_EXPR)
{ constant_boolean_node (off0 == off1, type); })