In commit d329775c2 ("simplify 'x != 0' or 'x == 1' to 'x'") the comparison was optimized away if the operand's size == 1 but this is only valid if the comparison also has a size == 1. Fix this by restricting this optimization only when both the comparison intruction and its operand has a size == 1. Fixes: d329775c2 ("simplify 'x != 0' or 'x == 1' to 'x'") Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- simplify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simplify.c b/simplify.c index b28d93755..839452b00 100644 --- a/simplify.c +++ b/simplify.c @@ -703,7 +703,7 @@ static int simplify_seteq_setne(struct instruction *insn, long long value) return 0; inverse = (insn->opcode == OP_SET_NE) == value; - if (!inverse && def->size == 1) { + if (!inverse && def->size == 1 && insn->size == 1) { // Replace: // setne %r <- %s, $0 // or: -- 2.18.0 -- 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