On 25/07/18 21:38, Luc Van Oostenryck wrote: > A zero-extension has no effect on the result of a comparison with 0 or 1. > > Optimize away the extension. > > Note: this simplification was already done but only when the > original size was 1 but it can be done for all sizes. > > Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> > --- > simplify.c | 17 +++++++---------- > validation/optim/bool-zext-test.c | 1 - > 2 files changed, 7 insertions(+), 11 deletions(-) > > diff --git a/simplify.c b/simplify.c > index b6c07ad9f..fb4bb3429 100644 > --- a/simplify.c > +++ b/simplify.c > @@ -608,16 +608,13 @@ static int simplify_seteq_setne(struct instruction *insn, long long value) > return REPEAT_CSE; > > case OP_ZEXT: > - if (def->orig_type->bit_size == 1) { > - // Convert: > - // zext.m %s <- (1) %a > - // setne.1 %r <- %s, $0 > - // into: > - // setne.1 %s <- %a, $0 > - // and same for setne/eq ... 0/1 > - return replace_pseudo(insn, &insn->src1, def->src1); > - } > - break; > + // Convert: > + // *ext.m %s <- (1) %a why *ext.m?, this is only zext - Ah, next patch you add sext! ;-) Hmm, maybe keep it as zext until next patch? > + // setne.1 %r <- %s, $0 > + // into: > + // setne.1 %s <- %a, $0 > + // and same for setne/eq ... 0/1 > + return replace_pseudo(insn, &insn->src1, def->src); Hmm, so this isn't just removing the conditional. In the context I can see that the last argument to replace_pseudo was def->src1 rather than def->src used here. I haven't given it much thought, just reading the patch text, but ... ATB, Ramsay Jones > } > return 0; > } > diff --git a/validation/optim/bool-zext-test.c b/validation/optim/bool-zext-test.c > index f837ace20..138938b0a 100644 > --- a/validation/optim/bool-zext-test.c > +++ b/validation/optim/bool-zext-test.c > @@ -6,7 +6,6 @@ _Bool neu1(unsigned char a) { return a != 1; } > /* > * check-name: bool-zext-test > * check-command: test-linearize -Wno-decl $file > - * check-known-to-fail > * > * check-output-ignore > * check-output-excludes: zext\\. > -- 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