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



--- Comment #9 from Teresa Johnson <tejohnson at google dot com> 2013-05-03 
15:40:16 UTC ---

The problem is that with the rounding divide, an odd numbered

probability being propagated along a 50-50 branch will be rounded up

along both edges, resulting in 1 higher probability being propagated

along the graph than with the earlier truncating divide. The algorithm

in sched-rgn.c is propagating the probabilities along the whole cfg,

and when these edges merge, we have 10001 as the accumulated

probability, which is higher than REG_BR_PROB_BASE.



The following patch fixes this for the attached test case:



Index: sched-rgn.c

===================================================================

--- sched-rgn.c (revision 198581)

+++ sched-rgn.c (working copy)

@@ -1442,6 +1442,8 @@ compute_dom_prob_ps (int bb)

  bitmap_set_bit (pot_split[bb], EDGE_TO_BIT (out_edge));



       prob[bb] += combine_probabilities (prob[pred_bb], in_edge->probability);

+      if (prob[bb] > REG_BR_PROB_BASE)

+ prob[bb] = REG_BR_PROB_BASE;

     }



   bitmap_set_bit (dom[bb], bb);



I am now testing with the full powerpc bootstrap build. This was the

only additional use of combine_probabilities in my patch, so there

shouldn't be any other issues like this. Will send the patch for

review once the bootstrap completes.



Teresa



On Fri, May 3, 2013 at 8:10 AM, tejohnson at google dot com

<gcc-bugzi...@gcc.gnu.org> wrote:

>

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

>

> --- Comment #7 from Teresa Johnson <tejohnson at google dot com> 2013-05-03 
> 15:10:50 UTC ---

> Thanks for the test case - reproduced with my stage1 compiler on gcc110. 
> Teresa

>

> On Fri, May 3, 2013 at 8:02 AM, dje at gcc dot gnu.org

> <gcc-bugzi...@gcc.gnu.org> wrote:

>>

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

>>

>> --- Comment #6 from David Edelsohn <dje at gcc dot gnu.org> 2013-05-03 
>> 15:02:18 UTC ---

>> Created attachment 30022

>>   --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30022

>> Testcase

>>

>> Testcase from Anton Blanchard transferred from PR 57161

>>

>> # gcc -O2 -c foo.c

>> foo.c: In function 'testcase':

>> foo.c:40:1: internal compiler error: in check_probability, at 
>> basic-block.h:941

>>  }

>>  ^

>> 0x105bb57b check_probability

>>     ../../gcc/gcc/basic-block.h:941

>> 0x105bb57b check_probability

>>     ../../gcc/gcc/sched-rgn.c:3247

>> 0x105bb57b combine_probabilities

>>     ../../gcc/gcc/basic-block.h:950

>> 0x105bb57b compute_dom_prob_ps

>>     ../../gcc/gcc/sched-rgn.c:1444

>> 0x105bb57b sched_rgn_local_init(int)

>>     ../../gcc/gcc/sched-rgn.c:3291

>> 0x105bd393 schedule_region

>>     ../../gcc/gcc/sched-rgn.c:2984

>> 0x105bd393 schedule_insns

>>     ../../gcc/gcc/sched-rgn.c:3384

>> 0x105bd393 schedule_insns()

>>     ../../gcc/gcc/sched-rgn.c:3363

>> 0x105bdbb3 rest_of_handle_sched

>>     ../../gcc/gcc/sched-rgn.c:3577

>>

>> --

>> Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email

>> ------- You are receiving this mail because: -------

>> You are on the CC list for the bug.

>

> --

> Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email

> ------- You are receiving this mail because: -------

> You are on the CC list for the bug.

Reply via email to