linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 1/5] let replace_with_pseudo() use kill_instruction()
Date: Sun, 29 Nov 2020 15:49:18 +0100	[thread overview]
Message-ID: <20201129144922.56209-2-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20201129144922.56209-1-luc.vanoostenryck@gmail.com>

In replace_with_pseudo(), the replaced instruction needs to be killed
and for this contains ts own code.

But this is a duplication of what is already done in kill_instruction().

So, replace this part of the code by a cal to kill_instruction().

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 simplify.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/simplify.c b/simplify.c
index de03d315ec33..29b368e94ff4 100644
--- a/simplify.c
+++ b/simplify.c
@@ -445,23 +445,7 @@ static inline int replace_pseudo(struct instruction *insn, pseudo_t *pp, pseudo_
 static int replace_with_pseudo(struct instruction *insn, pseudo_t pseudo)
 {
 	convert_instruction_target(insn, pseudo);
-
-	switch (insn->opcode) {
-	case OP_SEL:
-	case OP_RANGE:
-		kill_use(&insn->src3);
-	case OP_BINARY ... OP_BINCMP_END:
-		kill_use(&insn->src2);
-	case OP_UNOP ... OP_UNOP_END:
-	case OP_SYMADDR:
-		kill_use(&insn->src1);
-		break;
-
-	default:
-		assert(0);
-	}
-	insn->bb = NULL;
-	return REPEAT_CSE;
+	return kill_instruction(insn);
 }
 
 static inline int replace_with_value(struct instruction *insn, long long val)
-- 
2.29.2


  reply	other threads:[~2020-11-29 14:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-29 14:49 [PATCH 0/5] use replace_with_pseudo() for simplify_memops() Luc Van Oostenryck
2020-11-29 14:49 ` Luc Van Oostenryck [this message]
2020-11-29 14:49 ` [PATCH 2/5] make a header for simplification Luc Van Oostenryck
2020-11-29 14:49 ` [PATCH 3/5] make replace_with_pseudo() extern Luc Van Oostenryck
2020-11-29 14:49 ` [PATCH 4/5] memops: move rewrite_load_instruction() here Luc Van Oostenryck
2020-11-29 14:49 ` [PATCH 5/5] replace convert_load_instruction() by replace_with_pseudo() 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=20201129144922.56209-2-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).