This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: expected_retval attribute proposal
- To: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Subject: Re: expected_retval attribute proposal
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Wed, 10 May 2000 11:18:43 -0600
- cc: jh at suse dot cz, egcs at egcs dot cygnus dot com, libc-hacker at sourceware dot cygnus dot com
- Reply-To: law at cygnus dot com
In message <200005101715.TAA01106@loewis.home.cs.tu-berlin.de>you write:
> > Ideas? If this turns out to be acceptable hack, I will implement the gcc
> > part. (well and glibc part to if neccesary...)
>
> I wouldn't stop you from implementing this idea, but I'd like to see
> some use cases first. I.e. which of the glibc functions should have an
> expected_retval, and which one? Analysing the gcc source code, or the
> X11 source code (by means of grep), in how many cases are those
> functions used, and in how many of those cases are the return values
> relevant for branch prediction? (i.e. how many calls of those
> functions appear in if-statements)
>
> My feeling is that this could likely add a lot of machinery for little
> gain.
That's my gut feeling too.
Most return values are non-negative and we can use that to help predict
some branches based on return values. I doubt other reasonable to
implement heuristics for return values would be all that interesting.
jeff