This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Confusing description of GCC option `-freorder-blocks'
- From: Pengfei Yuan <0xcoolypf at gmail dot com>
- To: Kyrill Tkachov <kyrylo dot tkachov at arm dot com>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Mon, 1 Dec 2014 18:58:07 +0800
- Subject: Re: Confusing description of GCC option `-freorder-blocks'
- Authentication-results: sourceware.org; auth=none
- References: <CACmZjJJ9sG5G1DmxGzxBZGNrO+DHCkbyk6gGMd77YojdG8PHmQ at mail dot gmail dot com> <547C39F0 dot 6020907 at arm dot com>
2014-12-01 17:50 GMT+08:00 Kyrill Tkachov <kyrylo.tkachov@arm.com>:
>> In https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html , the
>> description of option `-freorder-blocks' says `in order to reduce
>> number of taken branches and improve code locality'. It is confusing.
>> When will the `and' condition happen? That is, taken branches reduced
>> AND code locality improved.
>
>
> I would think that one implies the other. If you reorder the blocks
> so as to reduce taken branches, that is by definition an improvement of
> code locality since you don't jump all over the place as much.
>
> Cheers,
> Kyrill
>
I see. Thank you very much!
I was misunderstanding branch taken as branch prediction...
Yuan