From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 2/3] use replace_with_value()
Date: Sat, 5 Sep 2020 14:13:57 +0200 [thread overview]
Message-ID: <20200905121358.83080-3-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20200905121358.83080-1-luc.vanoostenryck@gmail.com>
Replace existing 'replace_with_pseudo(insn, value_pseudo($N))'
by 'replace_with_value($N)'.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
simplify.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/simplify.c b/simplify.c
index 0c75b3fadcab..3c4b972ce607 100644
--- a/simplify.c
+++ b/simplify.c
@@ -838,7 +838,7 @@ static int simplify_shift(struct instruction *insn, pseudo_t pseudo, long long v
omask = def->src2->value;
nmask = omask & mask;
if (nmask == 0)
- return replace_with_pseudo(insn, value_pseudo(0));
+ return replace_with_value(insn, 0);
if (nmask == mask)
return replace_pseudo(insn, &insn->src1, def->src1);
if (nbr_users(pseudo) > 1)
@@ -874,7 +874,7 @@ static int simplify_shift(struct instruction *insn, pseudo_t pseudo, long long v
omask = def->src2->value;
nmask = omask & mask;
if (nmask == 0)
- return replace_with_pseudo(insn, value_pseudo(0));
+ return replace_with_value(insn, 0);
if (nmask == mask)
return replace_pseudo(insn, &insn->src1, def->src1);
// do not simplify into ((A << S) & (M << S))
@@ -912,7 +912,7 @@ new_value:
return replace_pseudo(insn, &insn->src1, pseudo->def->src1);
}
zero:
- return replace_with_pseudo(insn, value_pseudo(0));
+ return replace_with_value(insn, 0);
replace_mask:
insn->opcode = OP_AND;
insn->src2 = value_pseudo(mask);
@@ -1104,7 +1104,7 @@ static int simplify_constant_rightside(struct instruction *insn)
case OP_MODU: case OP_MODS:
if (value == 1)
- return replace_with_pseudo(insn, value_pseudo(0));
+ return replace_with_value(insn, 0);
return 0;
case OP_DIVU: case OP_DIVS:
@@ -1167,14 +1167,14 @@ static int simplify_binop_same_args(struct instruction *insn, pseudo_t arg)
warning(insn->pos, "self-comparison always evaluates to false");
case OP_SUB:
case OP_XOR:
- return replace_with_pseudo(insn, value_pseudo(0));
+ return replace_with_value(insn, 0);
case OP_SET_EQ:
case OP_SET_LE: case OP_SET_GE:
case OP_SET_BE: case OP_SET_AE:
if (Wtautological_compare)
warning(insn->pos, "self-comparison always evaluates to true");
- return replace_with_pseudo(insn, value_pseudo(1));
+ return replace_with_value(insn, 1);
case OP_AND:
case OP_OR:
@@ -1298,7 +1298,7 @@ static int simplify_constant_unop(struct instruction *insn)
mask = 1ULL << (insn->size-1);
res &= mask | (mask-1);
- replace_with_pseudo(insn, value_pseudo(res));
+ replace_with_value(insn, res);
return REPEAT_CSE;
}
@@ -1577,7 +1577,7 @@ static int simplify_select(struct instruction *insn)
if (cond == src2 && is_zero(src1)) {
kill_use(&insn->src1);
kill_use(&insn->src3);
- replace_with_pseudo(insn, value_pseudo(0));
+ replace_with_value(insn, 0);
return REPEAT_CSE;
}
return 0;
--
2.28.0
next prev parent reply other threads:[~2020-09-05 12:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-05 12:13 [PATCH 0/3] add and use new helper: replace_with_value() Luc Van Oostenryck
2020-09-05 12:13 ` [PATCH 1/3] add helper replace_with_value() Luc Van Oostenryck
2020-09-05 12:13 ` Luc Van Oostenryck [this message]
2020-09-05 12:13 ` [PATCH 3/3] replace_with_{pseudo,value}() can be tail-calls Luc Van Oostenryck
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=20200905121358.83080-3-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).