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 ipa/58862] [4.9 Regression] LTO profiledbootstrap failure: lto1: ICE in edge_badness, at ipa-inline.c:1008


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

--- Comment #4 from Teresa Johnson <tejohnson at google dot com> ---
On Tue, Oct 29, 2013 at 8:05 AM, tejohnson at google dot com
<gcc-bugzilla@gcc.gnu.org> wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58862
>
> Teresa Johnson <tejohnson at google dot com> changed:
>
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                  CC|                            |tejohnson at gcc dot gnu.org,
>                    |                            |tejohnson at google dot com
>
> --- Comment #3 from Teresa Johnson <tejohnson at google dot com> ---
> I hit the "verify_flow_info: Wrong probability of edge" error in a
> profiledbootstrap. I triaged this down to the following commit, made by me:
>
> ------------------------------------------------------------------------
> r203823 | tejohnson | 2013-10-18 07:36:53 -0700 (Fri, 18 Oct 2013) | 5 lines
> Changed paths:
>    M /trunk/gcc/ChangeLog
>    M /trunk/gcc/tree-ssa-tail-merge.c
>
> 2013-10-18  Teresa Johnson  <tejohnson@google.com>
>
>         * tree-ssa-tail-merge.c (replace_block_by): Update edge
>         weights during merging.
>
> ------------------------------------------------------------------------
>
> Investigating right now. Looks like there were profile weight insanities going
> into this code, that were magnified by the fixes being performed by my change.
> To avoid the error, I need to adjust the change I made to ensure that the
> profile insanities don't get propagated into the edge probabilities.
>
> In the case I looked at, the edge weight insanities were originally introduced
> during jump threading. I had previously made a fix to the profile updates being
> done by that optimization (r203041, committed by law), but there have been a
> number of changes to that code since then so this needs to be revisited.
>
> I will get a fix for the failure though hopefully today.

This patch fixes the profiledbootstrap errors I was looking at.
Testing will a full profiledbootstrap and a regular
bootstrap/regression test run.

2013-10-29  Teresa Johnson  <tejohnson@google.com>

        * tree-ssa-tail-merge.c (replace_block_by): Tolerate profile
        insanities when updating probabilities.

Index: tree-ssa-tail-merge.c
===================================================================
--- tree-ssa-tail-merge.c       (revision 204166)
+++ tree-ssa-tail-merge.c       (working copy)
@@ -1467,7 +1467,7 @@ static void
 replace_block_by (basic_block bb1, basic_block bb2)
 {
   edge pred_edge;
-  edge e1;
+  edge e1, e2;
   edge_iterator ei;
   unsigned int i;
   gimple bb2_phi;
@@ -1502,16 +1502,22 @@ replace_block_by (basic_block bb1, basic_block bb2
   bb2->count += bb1->count;

   /* Merge the outgoing edge counts from bb1 onto bb2.  */
+  gcov_type out_sum = 0;
   FOR_EACH_EDGE (e1, ei, bb1->succs)
     {
-      edge e2;
       e2 = find_edge (bb2, e1->dest);
       gcc_assert (e2);
       e2->count += e1->count;
-      /* Recompute the probability from the new merged edge count (bb2->count
-         was updated above).  */
-      e2->probability = GCOV_COMPUTE_SCALE (e2->count, bb2->count);
+      out_sum += e2->count;
     }
+  /* Recompute the edge probabilities from the new merged edge count.
+     Use the sum of the new merged edge counts computed above instead
+     of bb2's merged count, in case there are profile count insanities
+     making the bb count inconsistent with the edge weights.  */
+  FOR_EACH_EDGE (e2, ei, bb2->succs)
+    {
+      e2->probability = GCOV_COMPUTE_SCALE (e2->count, out_sum);
+    }

   /* Do updates that use bb1, before deleting bb1.  */
   release_last_vdef (bb1);

>
> Thanks,
> Teresa
>
> --
> 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]