In preparation for the simplification of TRUNC(TRUNC(x)), slightly reorganize the code doing the siplification of ZEXT(TRUNC(x)). Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- simplify.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/simplify.c b/simplify.c index ef98b205a..f8caa3512 100644 --- a/simplify.c +++ b/simplify.c @@ -1292,8 +1292,10 @@ static int simplify_cast(struct instruction *insn) } break; case OP_TRUNC: - osize = def->orig_type->bit_size; - if (insn->opcode == OP_ZEXT && size == osize) { + switch (insn->opcode) { + case OP_ZEXT: + if (size != def->orig_type->bit_size) + break; insn->opcode = OP_AND; insn->src2 = value_pseudo((1ULL << def->size) - 1); return replace_pseudo(insn, &insn->src1, def->src); -- 2.18.0