From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Christopher Li <sparse@chrisli.org>,
Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 7/8] check duplicated phi-nodes directly on dominators
Date: Thu, 13 Apr 2017 18:55:50 +0200 [thread overview]
Message-ID: <20170413165551.2785-8-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20170413165551.2785-1-luc.vanoostenryck@gmail.com>
Now that add_load_dominators() is integrated into
rewrite_load_instruction() we can check for duplicated
phi sources directly in the dominators list instead
to have to check the corresponding phi sources.
This is a preparatory step for the next patch where
unneeded phi sources are not created anymore.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
flow.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/flow.c b/flow.c
index b64a3f74a..d705abe2e 100644
--- a/flow.c
+++ b/flow.c
@@ -439,6 +439,7 @@ void rewrite_load_instruction(struct instruction *insn, struct instruction_list
struct ident *ident)
{
struct pseudo_list *dominators;
+ struct instruction *dom;
pseudo_t new, phi;
dominators = add_load_dominators(insn, doms, ident);
@@ -447,12 +448,12 @@ void rewrite_load_instruction(struct instruction *insn, struct instruction_list
* Check for somewhat common case of duplicate
* phi nodes.
*/
- new = first_pseudo(dominators)->def->src1;
- FOR_EACH_PTR(dominators, phi) {
- if (new != phi->def->src1)
+ new = first_instruction(doms)->target;
+ FOR_EACH_PTR(doms, dom) {
+ if (new != dom->target)
goto complex_phi;
- new->ident = new->ident ? : phi->ident;
- } END_FOR_EACH_PTR(phi);
+ new->ident = new->ident ? : ident ? : dom->target->ident;
+ } END_FOR_EACH_PTR(dom);
/*
* All the same pseudo - mark the phi-nodes unused
--
2.12.0
next prev parent reply other threads:[~2017-04-13 16:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-13 16:55 [PATCH 0/8] avoid creating orphaned OP_PHISRCs Luc Van Oostenryck
2017-04-13 16:55 ` [PATCH 1/8] extract add_dominator() from find_dominating_parents() Luc Van Oostenryck
2017-04-13 16:55 ` [PATCH 2/8] add helper add_load_dominators() Luc Van Oostenryck
2017-04-13 16:55 ` [PATCH 3/8] remove test on initial phi->ident Luc Van Oostenryck
2017-04-13 16:55 ` [PATCH 4/8] avoid phisrc orphaned by simplify_loads() Luc Van Oostenryck
2017-04-13 16:55 ` [PATCH 5/8] avoid phisrc orphaned by find_dominating_stores() Luc Van Oostenryck
2017-04-13 16:55 ` [PATCH 6/8] integrate add_load_dominators() into rewrite_load_instruction() Luc Van Oostenryck
2017-04-13 16:55 ` Luc Van Oostenryck [this message]
2017-04-13 16:55 ` [PATCH 8/8] avoid creating unneeded phi-sources Luc Van Oostenryck
2017-05-18 17:04 ` [PATCH 0/8] avoid creating orphaned OP_PHISRCs 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=20170413165551.2785-8-luc.vanoostenryck@gmail.com \
--to=luc.vanoostenryck@gmail.com \
--cc=linux-sparse@vger.kernel.org \
--cc=sparse@chrisli.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).