From 29c02e655dca7391afb7f2cbfab7c7bcb68361ac Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Thu, 11 Jan 2018 09:14:33 +0100 Subject: [PATCH] re PR tree-optimization/83189 (internal compiler error: in probability_in, at profile-count.h:1050) PR middle-end/83189 * gfortran.fortran-torture/compile/pr83189.f90: New testcase. * tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Handle zero profile. From-SVN: r256480 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ .../compile/{pr83081.f90 => pr83189.f90} | 0 gcc/tree-ssa-loop-manip.c | 3 ++- 4 files changed, 14 insertions(+), 1 deletion(-) rename gcc/testsuite/gfortran.fortran-torture/compile/{pr83081.f90 => pr83189.f90} (100%) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1a55b201090..32652720c89 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-01-10 Jan Hubicka + + PR middle-end/83189 + * gfortran.fortran-torture/compile/pr83189.f90: New testcase. + * tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Handle zero + profile. + 2018-01-10 Jan Hubicka PR middle-end/83575 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 68fe8ef65be..917370960c4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-01-10 Jan Hubicka + + PR middle-end/83189 + * gfortran.fortran-torture/compile/pr83189.f90: New testcase. + 2018-01-10 Jan Hubicka * gcc.c-torture/compile/pr83575.c: New testcase. diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/pr83081.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/pr83189.f90 similarity index 100% rename from gcc/testsuite/gfortran.fortran-torture/compile/pr83081.f90 rename to gcc/testsuite/gfortran.fortran-torture/compile/pr83189.f90 diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c index 80e91d0f0aa..bf425afd436 100644 --- a/gcc/tree-ssa-loop-manip.c +++ b/gcc/tree-ssa-loop-manip.c @@ -1378,7 +1378,8 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor, { /* Avoid dropping loop body profile counter to 0 because of zero count in loop's preheader. */ - freq_e = freq_e.force_nonzero (); + if (freq_h.nonzero_p () && !(freq_e == profile_count::zero ())) + freq_e = freq_e.force_nonzero (); scale_loop_frequencies (loop, freq_e.probability_in (freq_h)); } -- 2.30.2