This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

[Bug rtl-optimization/58033] counterproductive bb-reorder


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58033

--- Comment #4 from Teresa Johnson <tejohnson at google dot com> ---
On Tue, Jul 30, 2013 at 2:40 PM, olegendo at gcc dot gnu.org
<gcc-bugzilla@gcc.gnu.org> wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58033
>
> --- Comment #3 from Oleg Endo <olegendo at gcc dot gnu.org> ---
> Created attachment 30574
>   --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30574&action=edit
> bbro dump
>
> (In reply to Teresa Johnson from comment #2)
>>
>> I assume it is the above branch that is the issue (not the bf/s .L2
>> below as that is the same in both versions of the code). I'm assuming
>> this is not build with FDO?
>
> Right, no FDO.
>
>> In that case bbro is probably at the mercy
>> of whatever probabilities the static heuristics assigned to the
>> branches. Although if it is 50-50 then I'm not sure offhand what
>> happens - maybe it is biasing in favor of having the shortest trace?
>> This is a great test case for motivating range propagation. =)

Thanks for the dump. The issue is the heuristically assigned edge frequencies:

;;  succ:       6 [29.0%]  (FALLTHRU,CAN_FALLTHRU)
;;              4 [71.0%]  (CAN_FALLTHRU)

BB 6 contains the code within the then clause that is in fact always
executed. But it is being assigned only 29% probability, which is why
bbro lays out the code as it does.

I'm not familiar with the static edge weight heuristics in gcc, but it
would be interesting to see why it is predicting that the if statement
will be false.

Teresa

>>
>> Can you attach the dump created with -fdump-rtl-bbro-all? We can see
>> what the edge probabilities are. For some reason it is not compiling
>> for me - what options do you use? My (4_7-based) g++ is complaining
>> about the "auto":
>
> Sorry, it's C++11, so you need to specify -std=c++11.
>
> Here's a C++03 version, which on my setup (4.9 trunk rev 201282) results in
> exactly the same code:
>
> #include <bitset>
>
> std::bitset<32> make_bits2 (void)
> {
>   static const int ii[] = { 4, 5, 6, 10 };
>   std::bitset<32> r;
>   for (int i = 0; i < 4; ++i)
>     if (ii[i] < r.size ())
>       r.set (ii[i]);
>
>   return r;
> }
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.


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