diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2021-01-15 17:08:55 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2021-01-17 16:09:04 +0100 |
commit | 23756db02e8d8337075b377408af5093c0401de2 (patch) | |
tree | 0c34f6f81eb26e2510b7807653e8adfe29b4e9f8 | |
parent | 4cad79e4450180e8568bb16d06b5d6806b2db35b (diff) | |
download | sparse-23756db02e8d8337075b377408af5093c0401de2.tar.gz |
fix type of canonicalization of sext + unsigned compare
In commit 4a5f616407e2 ("cmp: canonicalize sext(x) cmpu C (with C >= SMAX)"),
the operand is replaced to avoid a sign extension but the corresponding
type was not updated. Fix this now.
Fixes: 4a5f616407e26efb67013f8267adef2d6e093bf1
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | simplify.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -1225,12 +1225,14 @@ static int simplify_compare_constant(struct instruction *insn, long long value) switch (insn->opcode) { case OP_SET_BE: if (value >= sign_bit(osize)) { + insn->itype = def->orig_type; replace_binop_value(insn, OP_SET_GE, 0); return replace_pseudo(insn, &insn->src1, def->src); } break; case OP_SET_A: if (value >= sign_bit(osize)) { + insn->itype = def->orig_type; replace_binop_value(insn, OP_SET_LT, 0); return replace_pseudo(insn, &insn->src1, def->src); } |