This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On 03/16/2017 06:54 AM, Trevor Saunders wrote:
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.+ 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 !=.
If a and b are booleans or unsigned, then ideally we'd canonicalize the test into an [in]equality test. At which point the existing code would fire recording a = 0 and b = 0 on the false edge. You still can't record anything on the true edge. I don't think we're good at the canonicalization these days.
For (a & b) != 0, unconstrained we could record a != 0 and b != 0 on the true edge, but nothing can be recorded on the false edge.
If we know a and b have boolean ranges we can refine that to a = 1 and b = 1 on the true edge, but again, nothing can be recorded on the false edge.
Jeff
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |