gimple-fold.c (gimple_fold_stmt_to_constant_1): Simplify bool comparison canonicalization and restrict to integers.

2015-08-06  Richard Biener  <rguenther@suse.de>

	* gimple-fold.c (gimple_fold_stmt_to_constant_1): Simplify
	bool comparison canonicalization and restrict to integers.

From-SVN: r226668
This commit is contained in:
Richard Biener 2015-08-06 08:45:52 +00:00 committed by Richard Biener
parent b168884abe
commit 8861704d23
2 changed files with 11 additions and 14 deletions

View File

@ -1,3 +1,8 @@
2015-08-06 Richard Biener <rguenther@suse.de>
* gimple-fold.c (gimple_fold_stmt_to_constant_1): Simplify
bool comparison canonicalization and restrict to integers.
2015-08-05 Andrew MacLeod <amacleod@redhat.com>
* coretypes.h (enum symbol_visibility): Relocate here.

View File

@ -5041,20 +5041,12 @@ gimple_fold_stmt_to_constant_1 (gimple stmt, tree (*valueize) (tree),
{
tree op1 = (*valueize) (gimple_assign_rhs2 (stmt));
op0 = (*valueize) (op0);
if (subcode == NE_EXPR)
{
if (integer_zerop (op1))
return op0;
else if (integer_zerop (op0))
return op1;
}
else
{
if (integer_onep (op1))
return op0;
else if (integer_onep (op0))
return op1;
}
if (TREE_CODE (op0) == INTEGER_CST)
std::swap (op0, op1);
if (TREE_CODE (op1) == INTEGER_CST
&& ((subcode == NE_EXPR && integer_zerop (op1))
|| (subcode == EQ_EXPR && integer_onep (op1))))
return op0;
}
}
return NULL_TREE;