Linux-Sparse 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 6/6] memops: we can kill addresses unconditionally
Date: Sun, 21 Mar 2021 18:08:22 +0100	[thread overview]
Message-ID: <20210321170822.46854-7-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20210321170822.46854-1-luc.vanoostenryck@gmail.com>

In rewrite_load_instruction(), if the load instruction is converted
into a phi-node, its address is then no more used and must be removed.

However, this is only done when this address is not a symbol.
This was explicitly done in the following commit because of the problem
of removing an element from the usage list while walking this list:
   602f6b6c0d41 ("Leave symbol pseudo usage intact when doing phi-node conversion.")

But currently rewrite_load_instruction() is only used during memops
simplification where the usage list is not walked.

So, kill the address' usage unconditionally.

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

diff --git a/memops.c b/memops.c
index 897fb6bf57fe..6d24604c2aae 100644
--- a/memops.c
+++ b/memops.c
@@ -45,9 +45,7 @@ static void rewrite_load_instruction(struct instruction *insn, struct pseudo_lis
 	goto end;
 
 complex_phi:
-	/* We leave symbol pseudos with a bogus usage list here */
-	if (insn->src->type != PSEUDO_SYM)
-		kill_use(&insn->src);
+	kill_use(&insn->src);
 	insn->opcode = OP_PHI;
 	insn->phi_list = dominators;
 
-- 
2.31.0


      parent reply	other threads:[~2021-03-21 17:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-21 17:08 [PATCH 0/6] memops: small cleanups Luc Van Oostenryck
2021-03-21 17:08 ` [PATCH 1/6] memops: dominates()s first arg is redundant Luc Van Oostenryck
2021-03-21 17:08 ` [PATCH 2/6] memops: find_dominating_parents()s generation " Luc Van Oostenryck
2021-03-21 17:08 ` [PATCH 3/6] memops: remove obsolete comment Luc Van Oostenryck
2021-03-21 17:08 ` [PATCH 4/6] memops: do not mess up with phisource's source ident Luc Van Oostenryck
2021-03-21 17:08 ` [PATCH 5/6] memops: avoid using first_pseudo() Luc Van Oostenryck
2021-03-21 17:08 ` Luc Van Oostenryck [this message]

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=20210321170822.46854-7-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 read-only IMAP folder(s) and NNTP newsgroup(s).