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 a1307e3..f3fb04f 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 6f407e1..15559ae 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 d22af7a..760422a 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