re PR bootstrap/63432 (profiledbootstrap failure with bootstrap-lto)
authorTeresa Johnson <tejohnson@google.com>
Wed, 15 Oct 2014 15:45:59 +0000 (15:45 +0000)
committerTeresa Johnson <tejohnson@gcc.gnu.org>
Wed, 15 Oct 2014 15:45:59 +0000 (15:45 +0000)
2014-10-15  Teresa Johnson  <tejohnson@google.com>

PR bootstrap/63432
* tree-ssa-threadupdate.c (recompute_probabilities): Better
overflow checking.

From-SVN: r216269

gcc/ChangeLog
gcc/tree-ssa-threadupdate.c

index 16817d4307d70db05068f90937b885512e3c52e7..9dc31881fb3327d05a4368dbdfdb503fc9f42b95 100644 (file)
@@ -1,3 +1,9 @@
+2014-10-15  Teresa Johnson  <tejohnson@google.com>
+
+       PR bootstrap/63432
+       * tree-ssa-threadupdate.c (recompute_probabilities): Better
+       overflow checking.
+
 2014-10-15  Renlin Li <renlin.li@arm.com>
 
        * config/aarch64/aarch64.h (TARGET_CPU_CPP_BUILTINS): Define
index 125f6f8776d98a0d7235e2b10d41ed7453cb774d..2be3ab2edf759cd6cc693b554502fc0ceec7985f 100644 (file)
@@ -871,21 +871,23 @@ recompute_probabilities (basic_block bb)
   edge_iterator ei;
   FOR_EACH_EDGE (esucc, ei, bb->succs)
     {
-      if (bb->count)
+      if (!bb->count)
+        continue;
+
+      /* Prevent overflow computation due to insane profiles.  */
+      if (esucc->count < bb->count)
         esucc->probability = GCOV_COMPUTE_SCALE (esucc->count,
                                                  bb->count);
-      if (esucc->probability > REG_BR_PROB_BASE)
-        {
-         /* Can happen with missing/guessed probabilities, since we
-            may determine that more is flowing along duplicated
-            path than joiner succ probabilities allowed.
-            Counts and freqs will be insane after jump threading,
-            at least make sure probability is sane or we will
-            get a flow verification error.
-            Not much we can do to make counts/freqs sane without
-            redoing the profile estimation.  */
-         esucc->probability = REG_BR_PROB_BASE;
-       }
+      else
+        /* Can happen with missing/guessed probabilities, since we
+           may determine that more is flowing along duplicated
+           path than joiner succ probabilities allowed.
+           Counts and freqs will be insane after jump threading,
+           at least make sure probability is sane or we will
+           get a flow verification error.
+           Not much we can do to make counts/freqs sane without
+           redoing the profile estimation.  */
+        esucc->probability = REG_BR_PROB_BASE;
     }
 }