Message ID | 20180807142633.88375-1-luc.vanoostenryck@gmail.com (mailing list archive) |
---|---|
State | Mainlined, archived |
Headers | show |
Series | use multi_users() instead on nbr_users() | expand |
On 07/08/18 15:26, Luc Van Oostenryck wrote: > Since multi_users() is cheaper than nbr_users(), use > the former when possible. > > Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> > --- > simplify.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/simplify.c b/simplify.c > index 4dfcf198d..b9a32e232 100644 > --- a/simplify.c > +++ b/simplify.c > @@ -751,7 +751,7 @@ static int simplify_seteq_setne(struct instruction *insn, long long value) > // and same for setne/eq ... 0/1 > return replace_pseudo(insn, &insn->src1, def->src); > case OP_TRUNC: > - if (nbr_users(old) > 1) > + if (multi_users(old)) In a previous review I suggested naming this function multiple_users() instead. When I read this patch, it just reinforced my initial feeling about the name! ;-) I can't claim to be very good at naming things, so please take this with a large dose of salt! ATB, Ramsay Jones > break; > // convert > // trunc.n %s <- (o) %a > @@ -1156,7 +1156,7 @@ static int simplify_cast(struct instruction *insn) > /* A cast of a AND might be a no-op.. */ > switch (insn->opcode) { > case OP_TRUNC: > - if (nbr_users(src) > 1) > + if (multi_users(src)) > break; > def->opcode = OP_TRUNC; > def->orig_type = def->type; > @@ -1174,7 +1174,7 @@ static int simplify_cast(struct instruction *insn) > break; > // OK, sign bit is 0 > case OP_ZEXT: > - if (nbr_users(src) > 1) > + if (multi_users(src)) > break; > // transform: > // and.n %b <- %a, M > -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Aug 08, 2018 at 01:01:25AM +0100, Ramsay Jones wrote: > > > On 07/08/18 15:26, Luc Van Oostenryck wrote: > > Since multi_users() is cheaper than nbr_users(), use > > the former when possible. > > > > Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> > > --- > > simplify.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/simplify.c b/simplify.c > > index 4dfcf198d..b9a32e232 100644 > > --- a/simplify.c > > +++ b/simplify.c > > @@ -751,7 +751,7 @@ static int simplify_seteq_setne(struct instruction *insn, long long value) > > // and same for setne/eq ... 0/1 > > return replace_pseudo(insn, &insn->src1, def->src); > > case OP_TRUNC: > > - if (nbr_users(old) > 1) > > + if (multi_users(old)) > > In a previous review I suggested naming this function > multiple_users() instead. When I read this patch, it > just reinforced my initial feeling about the name! ;-) Yes, indeed. I put this aspect aside and then I forgot it. > I can't claim to be very good at naming things, so please > take this with a large dose of salt! Oh, I think you're right but: * I prefer a short name * I suppose it depend a bit on how you read it: - this pseudo has multiple users - this pseudo is in the category 'multi-user(s)' In fact my initial intention was to use !single_user() but * people often prefer to avoid negation * it wouldn't reflect well the reality since the 3 possibilities are: - no users at all (but we're never interested in this case) - a single user - more than one user I don't know. I'm not very happy with the name myself. Maybe I should change slighty the semantic of ptr_list_multiple(), rename it ptr_list_single(), ptr_list_unique_entry() or something like this and use single_user(). -- Luc -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/simplify.c b/simplify.c index 4dfcf198d..b9a32e232 100644 --- a/simplify.c +++ b/simplify.c @@ -751,7 +751,7 @@ static int simplify_seteq_setne(struct instruction *insn, long long value) // and same for setne/eq ... 0/1 return replace_pseudo(insn, &insn->src1, def->src); case OP_TRUNC: - if (nbr_users(old) > 1) + if (multi_users(old)) break; // convert // trunc.n %s <- (o) %a @@ -1156,7 +1156,7 @@ static int simplify_cast(struct instruction *insn) /* A cast of a AND might be a no-op.. */ switch (insn->opcode) { case OP_TRUNC: - if (nbr_users(src) > 1) + if (multi_users(src)) break; def->opcode = OP_TRUNC; def->orig_type = def->type; @@ -1174,7 +1174,7 @@ static int simplify_cast(struct instruction *insn) break; // OK, sign bit is 0 case OP_ZEXT: - if (nbr_users(src) > 1) + if (multi_users(src)) break; // transform: // and.n %b <- %a, M
Since multi_users() is cheaper than nbr_users(), use the former when possible. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- simplify.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)