tree-predcom.c (tree_predictive_commoning_loop): Skip loop that only iterates 1 time.
authorBin Cheng <bin.cheng@arm.com>
Thu, 13 Oct 2016 11:05:53 +0000 (11:05 +0000)
committerBin Cheng <amker@gcc.gnu.org>
Thu, 13 Oct 2016 11:05:53 +0000 (11:05 +0000)
* tree-predcom.c (tree_predictive_commoning_loop): Skip loop that only
iterates 1 time.

gcc/testsuite
* gfortran.dg/vect/fast-math-mgrid-resid.f: New test string.

From-SVN: r241100

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/vect/fast-math-mgrid-resid.f
gcc/tree-predcom.c

index 74749aee8a5d3dd021c04c5d91b809800aa071e7..76ff0930d49d521d86e9d0b46d8942c996579112 100644 (file)
@@ -1,3 +1,8 @@
+2016-10-13  Bin Cheng  <bin.cheng@arm.com>
+
+       * tree-predcom.c (tree_predictive_commoning_loop): Skip loop that only
+       iterates 1 time.
+
 2016-10-13  Bin Cheng  <bin.cheng@arm.com>
 
        * tree-vect-loop-manip.c (adjust_vec_debug_stmts): Don't release
index 25fd0428575a43af321cfbe300201a9fad8aaa60..461246208571d128992940b1fc744341b78e3541 100644 (file)
@@ -1,3 +1,7 @@
+2016-10-13  Bin Cheng  <bin.cheng@arm.com>
+
+       * gfortran.dg/vect/fast-math-mgrid-resid.f: New test string.
+
 2016-10-13  Bin Cheng  <bin.cheng@arm.com>
 
        * gcc.dg/vect/vect-98.c: Refine test case.
index fcf475d3bbc93768bc84881d51dce8a2aabd54eb..88238f9b70e8431f8f418124cc8d872e12a51176 100644 (file)
@@ -42,3 +42,4 @@ C
 ! { dg-final { scan-tree-dump-times "Executing predictive commoning without unrolling" 1 "pcom" { target lp64 } } }
 ! { dg-final { scan-tree-dump-times "Executing predictive commoning without unrolling" 2 "pcom" { target ia32 } } }
 ! { dg-final { scan-tree-dump-times "Predictive commoning failed: no suitable chains" 0 "pcom" } }
+! { dg-final { scan-tree-dump-times "Loop iterates only 1 time, nothing to do" 1 "pcom" } }
index 096365ad9a10db51b6a84b72332db493386be085..14d53c2ae29323052418647fed21fc97e6d0a420 100644 (file)
@@ -2465,6 +2465,15 @@ tree_predictive_commoning_loop (struct loop *loop)
   if (dump_file && (dump_flags & TDF_DETAILS))
     fprintf (dump_file, "Processing loop %d\n",  loop->num);
 
+  /* Nothing for predicitive commoning if loop only iterates 1 time.  */
+  if (get_max_loop_iterations_int (loop) == 0)
+    {
+      if (dump_file && (dump_flags & TDF_DETAILS))
+       fprintf (dump_file, "Loop iterates only 1 time, nothing to do.\n");
+
+      return false;
+    }
+
   /* Find the data references and split them into components according to their
      dependence relations.  */
   auto_vec<loop_p, 3> loop_nest;