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 v2 06/10] add helper for pseudo's user-list's size
Date: Tue, 13 Feb 2018 22:58:08 +0100	[thread overview]
Message-ID: <20180213215812.18735-7-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20180213215812.18735-1-luc.vanoostenryck@gmail.com>

Add pseudo_user_list_size() instead of having to use
ptr_list_size() with an ugly cast.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 linearize.h | 5 +++++
 simplify.c  | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/linearize.h b/linearize.h
index c0c49bdf0..0a08c602e 100644
--- a/linearize.h
+++ b/linearize.h
@@ -325,6 +325,11 @@ static inline int has_use_list(pseudo_t p)
 	return (p && p->type != PSEUDO_VOID && p->type != PSEUDO_VAL);
 }
 
+static inline int pseudo_user_list_size(struct pseudo_user_list *list)
+{
+	return ptr_list_size((struct ptr_list *)list);
+}
+
 static inline struct pseudo_user *alloc_pseudo_user(struct instruction *insn, pseudo_t *pp)
 {
 	struct pseudo_user *user = __alloc_pseudo_user(0);
diff --git a/simplify.c b/simplify.c
index 8aac852b4..971f8ca91 100644
--- a/simplify.c
+++ b/simplify.c
@@ -179,7 +179,7 @@ static int delete_pseudo_user_list_entry(struct pseudo_user_list **list, pseudo_
 	} END_FOR_EACH_PTR(pu);
 	assert(count <= 0);
 out:
-	if (ptr_list_size((struct ptr_list *) *list) == 0)
+	if (pseudo_user_list_size(*list) == 0)
 		*list = NULL;
 	return count;
 }
@@ -797,7 +797,7 @@ static int simplify_associative_binop(struct instruction *insn)
 		return 0;
 	if (!simple_pseudo(def->src2))
 		return 0;
-	if (ptr_list_size((struct ptr_list *)def->target->users) != 1)
+	if (pseudo_user_list_size(def->target->users) != 1)
 		return 0;
 	switch_pseudo(def, &def->src1, insn, &insn->src2);
 	return REPEAT_CSE;
-- 
2.16.0


  parent reply	other threads:[~2018-02-13 22:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-13 21:58 [PATCH v2 00/10] fix usage when killing loads & stores Luc Van Oostenryck
2018-02-13 21:58 ` [PATCH v2 01/10] add testcase for bad killing of dominated stores Luc Van Oostenryck
2018-02-13 21:58 ` [PATCH v2 02/10] add testcases for converted loads Luc Van Oostenryck
2018-02-13 21:58 ` [PATCH v2 03/10] fix killing of " Luc Van Oostenryck
2018-02-13 21:58 ` [PATCH v2 04/10] kill dead stores when simplifying symbols Luc Van Oostenryck
2018-02-13 21:58 ` [PATCH v2 05/10] fix usage of deadborn loads Luc Van Oostenryck
2018-02-13 21:58 ` Luc Van Oostenryck [this message]
2018-02-13 21:58 ` [PATCH v2 07/10] add helper: has_users() Luc Van Oostenryck
2018-02-13 21:58 ` [PATCH v2 08/10] use has_users() in dead_insn() too Luc Van Oostenryck
2018-02-13 21:58 ` [PATCH v2 09/10] let kill_instruction() report if changes were made Luc Van Oostenryck
2018-02-13 21:58 ` [PATCH v2 10/10] kill dead loads 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=20180213215812.18735-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 NNTP newsgroup(s).