re PR tree-optimization/83189 (internal compiler error: in probability_in, at profile...
authorJan Hubicka <hubicka@ucw.cz>
Thu, 11 Jan 2018 08:14:33 +0000 (09:14 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Thu, 11 Jan 2018 08:14:33 +0000 (08:14 +0000)
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
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.fortran-torture/compile/pr83081.f90 [deleted file]
gcc/testsuite/gfortran.fortran-torture/compile/pr83189.f90 [new file with mode: 0644]
gcc/tree-ssa-loop-manip.c

index 1a55b201090797edf02924446247afc065fe7ef8..32652720c897790db8b9fe60c252dadba7235c11 100644 (file)
@@ -1,3 +1,10 @@
+2018-01-10  Jan Hubicka  <hubicka@ucw.cz>
+
+       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  <hubicka@ucw.cz>
 
        PR middle-end/83575
index 68fe8ef65befb043520cf4a9f0d0fac00437a64b..917370960c43983b83a9672e5456229234fb7e07 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-10  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR middle-end/83189
+       * gfortran.fortran-torture/compile/pr83189.f90: New testcase.
+
 2018-01-10  Jan Hubicka  <hubicka@ucw.cz>
 
        * 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/pr83081.f90
deleted file mode 100644 (file)
index 8e669ba..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-Module radin_mod
-  INTEGER, PARAMETER :: DP = selected_real_kind(14,200)
-Contains
-  Subroutine SPLIFT (X,Y,YP,YPP,N,IERR,ISX,A1,B1,AN,BN)
-    Integer,  Intent(in) :: N,ISX
-    Real(dp), Intent(in) :: X(N),Y(N),A1,B1,AN,BN
-    Real(dp), Intent(out) :: YP(N),YPP(N)
-    Real(dp), Allocatable, Dimension(:,:) :: W
-    NM1  = N-1
-    NM2  = N-2
-    If (ISX.Gt.0) GO TO 40
-    Do I=2,N
-       If (X(I)-X(I-1) .Le. 0) Then
-          IERR = 3
-          Return
-       Endif
-    End Do
-    Allocate(W(N,3))
-40  YPP(1) = 4*B1
-    DOLD = (Y(2)-Y(1))/W(2,2)
-    Do  I=2,NM2
-       DNEW   = (Y(I+1) - Y(I))/W(I+1,2)
-       YPP(I) = 6*(DNEW - DOLD)
-       YP(I)  = DOLD
-       DOLD = DNEW
-    End Do
-    Return
-  End Subroutine SPLIFT
-End Module radin_mod
-
diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/pr83189.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/pr83189.f90
new file mode 100644 (file)
index 0000000..8e669ba
--- /dev/null
@@ -0,0 +1,30 @@
+Module radin_mod
+  INTEGER, PARAMETER :: DP = selected_real_kind(14,200)
+Contains
+  Subroutine SPLIFT (X,Y,YP,YPP,N,IERR,ISX,A1,B1,AN,BN)
+    Integer,  Intent(in) :: N,ISX
+    Real(dp), Intent(in) :: X(N),Y(N),A1,B1,AN,BN
+    Real(dp), Intent(out) :: YP(N),YPP(N)
+    Real(dp), Allocatable, Dimension(:,:) :: W
+    NM1  = N-1
+    NM2  = N-2
+    If (ISX.Gt.0) GO TO 40
+    Do I=2,N
+       If (X(I)-X(I-1) .Le. 0) Then
+          IERR = 3
+          Return
+       Endif
+    End Do
+    Allocate(W(N,3))
+40  YPP(1) = 4*B1
+    DOLD = (Y(2)-Y(1))/W(2,2)
+    Do  I=2,NM2
+       DNEW   = (Y(I+1) - Y(I))/W(I+1,2)
+       YPP(I) = 6*(DNEW - DOLD)
+       YP(I)  = DOLD
+       DOLD = DNEW
+    End Do
+    Return
+  End Subroutine SPLIFT
+End Module radin_mod
+
index 80e91d0f0aa67c8742a0b1dda1472cdce0e404b8..bf425afd43601cf941c48dc01fdbf639c5e278f5 100644 (file)
@@ -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));
     }