This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: New attribute "infrequent"?


Jan Hubicka <jh@suse.cz> writes:

> Changing something else than -Ox to -Os is dificult to do - in
> general lots of our code initializes costs and various settings on
> the startup of compiler.

You are arguing that the compiler does certain things are done in the
compiler and that they are hard to change and conclude it is not good
to change it.  It harder to change it, yes.

Fact is that function-level attribution only works for very
disciplined programming and even then there are reasons to not do it
(attribution should not only allow to predict infrequent use, also
very frequent use should be predictable.

So while your goal is to add something on function-level I still
maintain that C-block level is needed as well.

> > Using __builtin_expect we can control the block ordering (though this
> > should be improved on as well) but as you say, aggressive
> In what way? I am just working in this area so it can be nice.

Cannot reproduce it in a small test case.  glibc uses __builtin_expect
extensively and the reordering not always takes this hint serious.
Short if-blocks of a negatively predicted if are still generated in
line instead of somewhere else.  This really should be unconditional.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]