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] fix killing OP_ASM
Date: Fri,  4 Dec 2020 17:13:49 +0100	[thread overview]
Message-ID: <20201204161349.68272-1-luc.vanoostenryck@gmail.com> (raw)

Currently OP_ASMs are only handled by default in kill_insn().
In consequence, the usage is not removed from their inputs,
possibly leaving dead pseudos.

Fix this by removing the usage on the input pseudos.

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

diff --git a/simplify.c b/simplify.c
index 851f94209975..a877b693b610 100644
--- a/simplify.c
+++ b/simplify.c
@@ -308,6 +308,15 @@ static void kill_use_list(struct pseudo_list *list)
 	} END_FOR_EACH_PTR(p);
 }
 
+static void kill_asm(struct instruction *insn)
+{
+	struct asm_constraint *con;
+
+	FOR_EACH_PTR(insn->asm_rules->inputs, con) {
+		kill_use(&con->pseudo);
+	} END_FOR_EACH_PTR(con);
+}
+
 ///
 // kill an instruction
 // @insn: the instruction to be killed
@@ -373,6 +382,12 @@ int kill_insn(struct instruction *insn, int force)
 		kill_use(&insn->target);
 		break;
 
+	case OP_ASM:
+		if (!force)
+			return 0;
+		kill_asm(insn);
+		break;
+
 	case OP_ENTRY:
 		/* ignore */
 		return 0;
-- 
2.29.2


                 reply	other threads:[~2020-12-04 16:15 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=20201204161349.68272-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).