A sign-extension following another sign-extension can always be simplified into a single sign-extension. Simplify away such instructions. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- simplify.c | 5 +++++ validation/optim/sext-sext.c | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/simplify.c b/simplify.c index b05124027..51c930fad 100644 --- a/simplify.c +++ b/simplify.c @@ -1090,6 +1090,11 @@ static int simplify_cast(struct instruction *insn) insn->orig_type = def->orig_type; return replace_pseudo(insn, &insn->src, def->src); } + switch (insn->opcode) { + case OP_SEXT: + insn->orig_type = def->orig_type; + return replace_pseudo(insn, &insn->src, def->src); + } break; } diff --git a/validation/optim/sext-sext.c b/validation/optim/sext-sext.c index 3f7a0efc7..604a7dd4f 100644 --- a/validation/optim/sext-sext.c +++ b/validation/optim/sext-sext.c @@ -6,7 +6,6 @@ int foo(signed char offset) /* * check-name: sext-sext * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-pattern(1): sext\\. -- 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