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
+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.
{
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;