Re: [PATCH 2/3] Add a lot of dummy returns to avoid warnings with NO_NORETURN

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

 



> Anyway, thanks for writing these patches.  I'm happy to see git get
> faster.  As a side question, do you know if gcc provides a way to
> print output about what profile-driven optimizations were especially
> compelling, so they could help people think about how to reorganize
> code to improve the non profile-driven builds, too?

Generally gcc has no idea how much difference an optimization makes.
It would need to run the code for that, but it doesn't.

That's generally only possible for JITs.

For some optimizations (basic block reordering) you could get
the same benefit with __builtin_expect.

But based on my own experience with __builtin_expect in other projects
I strongly recommend to not use it manually: people tend
to use it everywhere eventually and they often get it wrong.
Humans are quite bad at deciding such things. Also code behaviour
changes over time and then the annotations often become outdated.

[e.g. the kernel has a special profiler for builtin_expects --
aka unlikely -- which checks the manual annotation against
the true runtime behaviour and the failure rate of manual annotation 
is quite spectacular]

In addition there are various optimizations in gcc where I am not
aware of a manual annotation possibility (like register allocation). 
The data from profile feedback is used in quite a lot of places all
over the compiler.

-Andi
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]