Commit 9dc167ec by Richard Guenther Committed by Richard Biener

fold-const.c (fold_binary): Remove duplicate folding of comparison of non-null…

fold-const.c (fold_binary): Remove duplicate folding of comparison of non-null ADDR_EXPR against null.

2007-03-05  Richard Guenther  <rguenther@suse.de>

	* fold-const.c (fold_binary): Remove duplicate folding
	of comparison of non-null ADDR_EXPR against null.

From-SVN: r122551
parent 3cf0c3c5
2007-03-05 Richard Guenther <rguenther@suse.de> 2007-03-05 Richard Guenther <rguenther@suse.de>
* fold-const.c (fold_binary): Remove duplicate folding
of comparison of non-null ADDR_EXPR against null.
2007-03-05 Richard Guenther <rguenther@suse.de>
Dorit Nuzman <dorit@il.ibm.com> Dorit Nuzman <dorit@il.ibm.com>
PR tree-optimization/26420 PR tree-optimization/26420
......
...@@ -11159,14 +11159,6 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) ...@@ -11159,14 +11159,6 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
&& code == EQ_EXPR) && code == EQ_EXPR)
return fold_build1 (TRUTH_NOT_EXPR, type, arg0); return fold_build1 (TRUTH_NOT_EXPR, type, arg0);
/* If this is an equality comparison of the address of a non-weak
object against zero, then we know the result. */
if (TREE_CODE (arg0) == ADDR_EXPR
&& VAR_OR_FUNCTION_DECL_P (TREE_OPERAND (arg0, 0))
&& ! DECL_WEAK (TREE_OPERAND (arg0, 0))
&& integer_zerop (arg1))
return constant_boolean_node (code != EQ_EXPR, type);
/* If this is an equality comparison of the address of two non-weak, /* If this is an equality comparison of the address of two non-weak,
unaliased symbols neither of which are extern (since we do not unaliased symbols neither of which are extern (since we do not
have access to attributes for externs), then we know the result. */ have access to attributes for externs), then we know the result. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment