aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2013-10-29 20:39:49 +0000
committerTeresa Johnson <tejohnson@gcc.gnu.org>2013-10-29 20:39:49 +0000
commitb6c00353648731a6f4dd6bb3e726f6ed1a75d701 (patch)
treecd09d98196fdcbec83ad291dd14cd15021fce136 /gcc
parent258125712b073aa7407e716f45524beed39ec840 (diff)
downloadgcc-b6c00353648731a6f4dd6bb3e726f6ed1a75d701.zip
gcc-b6c00353648731a6f4dd6bb3e726f6ed1a75d701.tar.gz
gcc-b6c00353648731a6f4dd6bb3e726f6ed1a75d701.tar.bz2
re PR ipa/58862 (LTO profiledbootstrap failure: lto1: ICE in edge_badness, at ipa-inline.c:1008)
2013-10-29 Teresa Johnson <tejohnson@google.com> PR ipa/58862 * tree-ssa-tail-merge.c (replace_block_by): Tolerate profile insanities when updating probabilities. From-SVN: r204178
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/tree-ssa-tail-merge.c16
2 files changed, 17 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9f350ce..d7be352 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2013-10-29 Teresa Johnson <tejohnson@google.com>
+
+ PR ipa/58862
+ * tree-ssa-tail-merge.c (replace_block_by): Tolerate profile
+ insanities when updating probabilities.
+
2013-10-29 David Malcolm <dmalcolm@redhat.com>
* gdbhooks.py (CGraphNodePrinter.to_string): Update gdb
diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c
index be5b71e..db95ce1 100644
--- a/gcc/tree-ssa-tail-merge.c
+++ b/gcc/tree-ssa-tail-merge.c
@@ -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,15 +1502,21 @@ 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. */