aboutsummaryrefslogtreecommitdiff
path: root/gcc/match.pd
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-10-14 12:59:15 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-10-14 12:59:15 +0000
commitc3bea07622b9a0ffc7a6724c06a04c9801642dfd (patch)
tree1c951111002e36e36791d6b8c618654105a3bdc9 /gcc/match.pd
parent0155ad4011c58e3608d88e76d1fa0f628ccedcdb (diff)
downloadgcc-c3bea07622b9a0ffc7a6724c06a04c9801642dfd.zip
gcc-c3bea07622b9a0ffc7a6724c06a04c9801642dfd.tar.gz
gcc-c3bea07622b9a0ffc7a6724c06a04c9801642dfd.tar.bz2
re PR tree-optimization/67915 (ICE on valid code at -O2 and -O3 on x86_64-linux-gnu)
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. From-SVN: r228810
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 6714796..655c9ff 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); })