From b8a4b8c838f2796acd1dc1e5f89ba71701f8f135 Mon Sep 17 00:00:00 2001 From: Bin Cheng Date: Thu, 13 Oct 2016 11:05:53 +0000 Subject: [PATCH] tree-predcom.c (tree_predictive_commoning_loop): Skip loop that only iterates 1 time. * 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 | 5 +++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gfortran.dg/vect/fast-math-mgrid-resid.f | 1 + gcc/tree-predcom.c | 9 +++++++++ 4 files changed, 19 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 74749ae..76ff093 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2016-10-13 Bin Cheng + * tree-predcom.c (tree_predictive_commoning_loop): Skip loop that only + iterates 1 time. + +2016-10-13 Bin Cheng + * tree-vect-loop-manip.c (adjust_vec_debug_stmts): Don't release adjust_vec automatically. (slpeel_add_loop_guard): Remove param cond_expr_stmt_list. Rename diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 25fd042..4612462 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2016-10-13 Bin Cheng + * gfortran.dg/vect/fast-math-mgrid-resid.f: New test string. + +2016-10-13 Bin Cheng + * gcc.dg/vect/vect-98.c: Refine test case. * gcc.dg/vect/vect-strided-a-u8-i8-gap2.c: Increase niters. * gcc.dg/vect/vect-strided-u8-i8-gap2.c: Ditto. diff --git a/gcc/testsuite/gfortran.dg/vect/fast-math-mgrid-resid.f b/gcc/testsuite/gfortran.dg/vect/fast-math-mgrid-resid.f index fcf475d..88238f9 100644 --- a/gcc/testsuite/gfortran.dg/vect/fast-math-mgrid-resid.f +++ b/gcc/testsuite/gfortran.dg/vect/fast-math-mgrid-resid.f @@ -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" } } diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c index 096365a..14d53c2 100644 --- a/gcc/tree-predcom.c +++ b/gcc/tree-predcom.c @@ -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_nest; -- 2.7.4