The simplification of ZEXT(ZEXT(x)) was already added but its dual, TRUNC(TRUNC(x)), was not. Add it now. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- simplify.c | 3 +++ validation/optim/trunc-trunc.c | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/simplify.c b/simplify.c index f8caa3512..0fcc7c25b 100644 --- a/simplify.c +++ b/simplify.c @@ -1293,6 +1293,9 @@ static int simplify_cast(struct instruction *insn) break; case OP_TRUNC: switch (insn->opcode) { + case OP_TRUNC: + insn->orig_type = def->orig_type; + return replace_pseudo(insn, &insn->src1, def->src); case OP_ZEXT: if (size != def->orig_type->bit_size) break; diff --git a/validation/optim/trunc-trunc.c b/validation/optim/trunc-trunc.c index c01d81f67..6dc50aeef 100644 --- a/validation/optim/trunc-trunc.c +++ b/validation/optim/trunc-trunc.c @@ -6,7 +6,6 @@ char foo(int a) /* * check-name: trunc-trunc * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-pattern(1): trunc\\. -- 2.18.0