From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH] fix type of canonicalization of sext + unsigned compare
Date: Sun, 17 Jan 2021 16:13:55 +0100 [thread overview]
Message-ID: <20210117151355.30515-1-luc.vanoostenryck@gmail.com> (raw)
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>
---
simplify.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/simplify.c b/simplify.c
index b0d2c1b5b7c6..1e7648486c49 100644
--- a/simplify.c
+++ b/simplify.c
@@ -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);
}
--
2.30.0
reply other threads:[~2021-01-17 15:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210117151355.30515-1-luc.vanoostenryck@gmail.com \
--to=luc.vanoostenryck@gmail.com \
--cc=linux-sparse@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).