From 6faa91548255490c2dc61a25596c33e6d5fc537e Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 13 Nov 2015 08:47:05 +0000 Subject: [PATCH] tree-vect-loop.c (vect_analyze_loop_2): Add fatal parameter. 2015-11-13 Richard Biener * tree-vect-loop.c (vect_analyze_loop_2): Add fatal parameter. Signal fatal failure if early checks fail. (vect_analyze_loop): If vect_analyze_loop_2 fails fatally do not bother testing further vector sizes. From-SVN: r230292 --- gcc/ChangeLog | 7 +++++++ gcc/tree-vect-loop.c | 15 +++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 666545eba8e..73668fa15db 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-11-13 Richard Biener + + * tree-vect-loop.c (vect_analyze_loop_2): Add fatal parameter. + Signal fatal failure if early checks fail. + (vect_analyze_loop): If vect_analyze_loop_2 fails fatally + do not bother testing further vector sizes. + 2015-11-13 Uros Bizjak * config/i386/predicates.md (misaligned_operand): Return true if diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 55e53093caa..b2fac611851 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -1709,13 +1709,16 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo) for it. The different analyses will record information in the loop_vec_info struct. */ static bool -vect_analyze_loop_2 (loop_vec_info loop_vinfo) +vect_analyze_loop_2 (loop_vec_info loop_vinfo, bool &fatal) { bool ok; int max_vf = MAX_VECTORIZATION_FACTOR; int min_vf = 2; unsigned int n_stmts = 0; + /* The first group of checks is independent of the vector size. */ + fatal = true; + /* Find all data references in the loop (which correspond to vdefs/vuses) and analyze their evolution in the loop. */ @@ -1795,7 +1798,6 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo) /* Classify all cross-iteration scalar data-flow cycles. Cross-iteration cycles caused by virtual phis are analyzed separately. */ - vect_analyze_scalar_cycles (loop_vinfo); vect_pattern_recog (loop_vinfo); @@ -1825,6 +1827,9 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo) return false; } + /* While the rest of the analysis below depends on it in some way. */ + fatal = false; + /* Analyze data dependences between the data-refs in the loop and adjust the maximum vectorization factor according to the dependences. @@ -2118,7 +2123,8 @@ vect_analyze_loop (struct loop *loop) return NULL; } - if (vect_analyze_loop_2 (loop_vinfo)) + bool fatal = false; + if (vect_analyze_loop_2 (loop_vinfo, fatal)) { LOOP_VINFO_VECTORIZABLE_P (loop_vinfo) = 1; @@ -2128,7 +2134,8 @@ vect_analyze_loop (struct loop *loop) destroy_loop_vec_info (loop_vinfo, true); vector_sizes &= ~current_vector_size; - if (vector_sizes == 0 + if (fatal + || vector_sizes == 0 || current_vector_size == 0) return NULL; -- 2.30.2