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 5/6] let find_dominating_parents() use insert_last_instruction()
Date: Sun, 21 Mar 2021 17:16:08 +0100	[thread overview]
Message-ID: <20210321161609.45905-6-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20210321161609.45905-1-luc.vanoostenryck@gmail.com>

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

diff --git a/memops.c b/memops.c
index ff54208e2d54..f74bff2abf88 100644
--- a/memops.c
+++ b/memops.c
@@ -65,8 +65,8 @@ static int find_dominating_parents(pseudo_t pseudo, struct instruction *insn,
 	struct basic_block *parent;
 
 	FOR_EACH_PTR(bb->parents, parent) {
+		struct instruction *phisrc;
 		struct instruction *one;
-		struct instruction *br;
 		pseudo_t phi;
 
 		FOR_EACH_PTR_REVERSE(parent->insns, one) {
@@ -95,12 +95,12 @@ no_dominance:
 		continue;
 
 found_dominator:
-		br = delete_last_instruction(&parent->insns);
-		phi = alloc_phi(parent, one->target, one->type);
+		phisrc = alloc_phisrc(one->target, one->type);
+		phisrc->phi_node = insn;
+		insert_last_instruction(parent, phisrc);
+		phi = phisrc->target;
 		phi->ident = phi->ident ? : one->target->ident;
-		add_instruction(&parent->insns, br);
 		use_pseudo(insn, phi, add_pseudo(dominators, phi));
-		phi->def->phi_node = insn;
 	} END_FOR_EACH_PTR(parent);
 	return 1;
 }		
-- 
2.31.0


  parent reply	other threads:[~2021-03-21 16:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-21 16:16 [PATCH 0/6] use an helper to add an instruction to a BB Luc Van Oostenryck
2021-03-21 16:16 ` [PATCH 1/6] add insert_last_instruction() Luc Van Oostenryck
2021-03-21 16:16 ` [PATCH 2/6] replace add_instruction_to_end() by insert_last_instruction() Luc Van Oostenryck
2021-03-21 16:16 ` [PATCH 3/6] let insert_select() use insert_last_instruction() Luc Van Oostenryck
2021-03-21 16:16 ` [PATCH 4/6] let insert_phis() " Luc Van Oostenryck
2021-03-21 16:16 ` Luc Van Oostenryck [this message]
2021-03-21 16:16 ` [PATCH 6/6] let ssa_rename_phi() " 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=20210321161609.45905-6-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).