re PR tree-optimization/83963 ([graphite] ICE in merge_sese, at graphite-scop-detecti...
authorRichard Biener <rguenther@suse.de>
Tue, 23 Jan 2018 08:00:20 +0000 (08:00 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 23 Jan 2018 08:00:20 +0000 (08:00 +0000)
2018-01-23  Richard Biener  <rguenther@suse.de>

PR tree-optimization/83963
* graphite-scop-detection.c (scop_detection::harmful_loop_in_region):
Properly terminate dominator walk when crossing the exit edge not
when visiting its source block.

* gfortran.dg/graphite/pr83963.f: New testcase.
* gcc.dg/graphite/pr83963-2.c: Likewise.

From-SVN: r256973

gcc/ChangeLog
gcc/graphite-scop-detection.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/graphite/pr83963-2.c [new file with mode: 0644]
gcc/testsuite/gfortran.dg/graphite/pr83963.f [new file with mode: 0644]

index a1307e34b5091ab1dde2714b832b29bf1795d2ea..f3fb04f2be04e7c019ced6096ea63c94c5a0d820 100644 (file)
@@ -1,3 +1,10 @@
+2018-01-23  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/83963
+       * graphite-scop-detection.c (scop_detection::harmful_loop_in_region):
+       Properly terminate dominator walk when crossing the exit edge not
+       when visiting its source block.
+
 2018-01-23  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/83918
index 6f407e16c887d66ad34a5ce33cfffe79fbe1cea8..15559ae5ee6b052cb2501ce89fbccea78cdd5a9d 100644 (file)
@@ -677,10 +677,10 @@ scop_detection::harmful_loop_in_region (sese_l scop) const
        if (!stmt_simple_for_scop_p (scop, gsi_stmt (gsi), bb))
          return true;
 
-      if (bb != exit_bb)
-       for (basic_block dom = first_dom_son (CDI_DOMINATORS, bb);
-            dom;
-            dom = next_dom_son (CDI_DOMINATORS, dom))
+      for (basic_block dom = first_dom_son (CDI_DOMINATORS, bb);
+          dom;
+          dom = next_dom_son (CDI_DOMINATORS, dom))
+       if (dom != scop.exit->dest)
          worklist.safe_push (dom);
     }
 
index d22af7ab9270eb3abb7db1e593be942b38a01cc2..760422aee58fca75dfcae07e6a6b72c70d74d69c 100644 (file)
@@ -1,3 +1,9 @@
+2018-01-23  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/83963
+       * gfortran.dg/graphite/pr83963.f: New testcase.
+       * gcc.dg/graphite/pr83963-2.c: Likewise.
+
 2018-01-23  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/83918
diff --git a/gcc/testsuite/gcc.dg/graphite/pr83963-2.c b/gcc/testsuite/gcc.dg/graphite/pr83963-2.c
new file mode 100644 (file)
index 0000000..56a279c
--- /dev/null
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O -floop-nest-optimize" } */
+
+int Chv_countBigEntries (int npivot, int pivotsizes[], int countflag,
+                        double droptol, int nD)
+{
+  double absval ;
+  double *entries ;
+  int count;
+  int ii, jj, kinc, kk, kstart, stride ;
+  for ( ii = 0 ; ii < nD ; ii++ )
+    { 
+      kk = kstart ;  
+      kinc = stride ;
+      for ( jj = 0 ; jj < ii ; jj++ )
+       {
+         absval = __builtin_fabs(entries[kk]) ; 
+         if ( absval >= droptol )
+           count++ ;   
+         kk += kinc ;    
+         kinc -= 2 ; 
+       }
+      kstart-- ;   
+    }
+  return count;
+}
diff --git a/gcc/testsuite/gfortran.dg/graphite/pr83963.f b/gcc/testsuite/gfortran.dg/graphite/pr83963.f
new file mode 100644 (file)
index 0000000..4e64102
--- /dev/null
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! { dg-options "-O -floop-nest-optimize" }
+
+      SUBROUTINE DAVCI(NORB,NCOR,NCI,NA,NB,
+     *    CI,MAXP,MAXW1,
+     *      IHMCON,ISTRB,ISTRP,ISTAR,II)
+      DIMENSION EC(MAXP,MAXP),IWRK1(2*MAXW1)
+         EC(II,II) = 1.0D+00
+         DO 1396 II=1,MAXP
+            DO 1398 JJ=1,II-1
+               EC(II,JJ) = 0.0D+00
+ 1398       CONTINUE
+ 1396    CONTINUE
+      IF (NA.EQ.NB) THEN
+      CALL RINAB0(SI1,SI2,NORB,NCOR,NCI,NA,NB,CI(1,IP),IACON1,IBCON1,
+     *       IWRK1,IHMCON,ISTRB,ISTRP,ISTAR)
+      ENDIF
+      END