On Thu, 16 Mar 2017, Jeff Law wrote:
On 03/16/2017 06:54 AM, Trevor Saunders wrote:
+ if (TREE_CODE (op0) == SSA_NAME && integer_zerop (op1))
+ {
+ enum tree_code code = eq->cond.ops.binary.op;
+ if ((code == EQ_EXPR && eq->value == boolean_true_node)
+ || (code == NE_EXPR && eq->value == boolean_false_node))
+ derive_equivalencs_from_bit_ior (op0, const_and_copies);
+
+ /* TODO: We could handle BIT_AND_EXPR in a similar fashion
+ recording that the operands have a nonzero value. */
+
+ /* TODO: We can handle more cases here, particularly when OP0
is
+ known to have a boolean range. */
I don't think its necessarily useful to put a list here of all possible
improvements, but we could also handle things like if ((a | b) </> 0)
since those imply !=.
The equivalences you derive here must hold for both objects. So without
additional range information you can't really determine anything about (a |
b) > 0.
I didn't follow the discussion so I am probably completely off, but
(a|b)>=0 is equivalent to (a>=0)&(b>=0) since it just tests for the sign
bit (surprisingly we seem to generate different code for the 2 versions).
--
Marc Glisse