Re: [PATCH] use multi_users() instead on nbr_users()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
> > ---
> >  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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux