>commit 5674da2d1af2467605fcc9b798fb54ee2d28efc7 >Author: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> >Date: Mon Mar 20 15:18:53 2017 +0100 > > canonicalize compare instructions > > Currently only commutative instructions are canonicalized > (the "simpler" operands, often a constant, is forced, if present > to be in the second operand). This improve CSE (more cases are > considered as equivalent) and help to reduce the number of "pattern" > to be handled at simplification. > > const struct opcode_table opcode_table[OP_LAST] = { >- [OP_SET_EQ] = { .negate = OP_SET_NE, }, >- [OP_SET_NE] = { .negate = OP_SET_EQ, }, >- [OP_SET_LT] = { .negate = OP_SET_GE, }, >- [OP_SET_LE] = { .negate = OP_SET_GT, }, >- [OP_SET_GE] = { .negate = OP_SET_LT, }, >- [OP_SET_GT] = { .negate = OP_SET_LE, }, >- [OP_SET_B ] = { .negate = OP_SET_AE, }, >- [OP_SET_BE] = { .negate = OP_SET_A , }, >- [OP_SET_AE] = { .negate = OP_SET_B , }, >- [OP_SET_A ] = { .negate = OP_SET_BE, }, >+ [OP_SET_EQ] = { .negate = OP_SET_NE, .swap = OP_SET_EQ, }, >+ [OP_SET_NE] = { .negate = OP_SET_EQ, .swap = OP_SET_NE, }, >+ [OP_SET_LT] = { .negate = OP_SET_GE, .swap = OP_SET_GT, }, >+ [OP_SET_LE] = { .negate = OP_SET_GT, .swap = OP_SET_GE, }, >+ [OP_SET_GE] = { .negate = OP_SET_LT, .swap = OP_SET_LE, }, >+ [OP_SET_GT] = { .negate = OP_SET_LE, .swap = OP_SET_LT, }, >+ [OP_SET_B ] = { .negate = OP_SET_AE, .swap = OP_SET_A , }, >+ [OP_SET_BE] = { .negate = OP_SET_A , .swap = OP_SET_AE, }, >+ [OP_SET_AE] = { .negate = OP_SET_B , .swap = OP_SET_BE, }, >+ [OP_SET_A ] = { .negate = OP_SET_BE, .swap = OP_SET_B , }, Notice that LT and GT and equivalent instructions after swapping the src. Another way to do it we might just remove one kind of instruction from the sparse IR. From the linearization point just map GT into LT and swap the source. So the IR does not allow those duplicated equilateral instructions. There is less canonization to be done. Chris -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html