No functional changes here. Just moving code around to prepare the following patch. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- simplify.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/simplify.c b/simplify.c index 3a5ae9331..5fb1a8cd3 100644 --- a/simplify.c +++ b/simplify.c @@ -539,6 +539,21 @@ undef: return NULL; } +static long long check_shift_count(struct instruction *insn, unsigned long long uval) +{ + unsigned int size = insn->size; + + if (uval < size) + return uval; + if (insn->tainted) + return uval; + + if (Wshift_count_overflow) { + warning(insn->pos, "shift by bigger than operand's width"); + } + insn->tainted = 1; + return uval; +} static int simplify_shift(struct instruction *insn, pseudo_t pseudo, long long value) { @@ -546,13 +561,9 @@ static int simplify_shift(struct instruction *insn, pseudo_t pseudo, long long v if (!value) return replace_with_pseudo(insn, pseudo); + value = check_shift_count(insn, value); size = insn->size; - if (value >= size && !insn->tainted) { - if (Wshift_count_overflow) - warning(insn->pos, "shift by bigger than operand's width"); - insn->tainted = 1; - } switch (insn->opcode) { case OP_ASR: break; -- 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