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] do not call simplify_instruction() if already removed
Date: Sat,  7 Nov 2020 13:57:49 +0100	[thread overview]
Message-ID: <20201107125749.12618-1-luc.vanoostenryck@gmail.com> (raw)

simplify_instruction() is called on every instructions, even
those already removed. It's useless (and annoying when debugging).

So, filter out removed instructions before calling simplify_instruction().

Fixes: c5ba883e6ac47381f8112ed33f22a931a79ac517
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 optimize.c | 2 ++
 simplify.c | 3 ---
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/optimize.c b/optimize.c
index 31d94e6158ef..bfab74c01b62 100644
--- a/optimize.c
+++ b/optimize.c
@@ -34,6 +34,8 @@ static void clean_up_insns(struct entrypoint *ep)
 	FOR_EACH_PTR(ep->bbs, bb) {
 		struct instruction *insn;
 		FOR_EACH_PTR(bb->insns, insn) {
+			if (!insn->bb)
+				continue;
 			repeat_phase |= simplify_instruction(insn);
 			if (!insn->bb)
 				continue;
diff --git a/simplify.c b/simplify.c
index f2aaa52de84b..ba63f28a3231 100644
--- a/simplify.c
+++ b/simplify.c
@@ -1916,9 +1916,6 @@ int simplify_instruction(struct instruction *insn)
 	unsigned flags;
 	int changed = 0;
 
-	if (!insn->bb)
-		return 0;
-
 	flags = opcode_table[insn->opcode].flags;
 	if (flags & OPF_TARGET) {
 		if (!has_users(insn->target))
-- 
2.29.2


                 reply	other threads:[~2020-11-07 12:58 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=20201107125749.12618-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).