The following enables ranger for the vectorizer, this lets niter
analysis use the active ranger to simplify conditions.

Bootstrapped and tested on x86_64-unknown-linux-gnu, I see
maybe-zero checks avoided but it's quite difficult to scan
this from dump files, and later VRP passes tend to optimize
those.  I failed to create a quick&dirty versioning-for-niter-assumptions
testcase that would be resolved, so no testcase for this.

Pushed.

        PR tree-optimization/122587
        * tree-vectorizer.cc (pass_vectorize::execute): Enable
        ranger around analysis and code generation.
---
 gcc/tree-vectorizer.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/tree-vectorizer.cc b/gcc/tree-vectorizer.cc
index 97b6297fb14..e7a3f265048 100644
--- a/gcc/tree-vectorizer.cc
+++ b/gcc/tree-vectorizer.cc
@@ -83,6 +83,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "internal-fn.h"
 #include "tree-ssa-sccvn.h"
 #include "tree-into-ssa.h"
+#include "gimple-range.h"
 
 /* Loop or bb location, with hotness information.  */
 dump_user_location_t vect_location;
@@ -1279,6 +1280,7 @@ pass_vectorize::execute (function *fun)
     note_simd_array_uses (&simd_array_to_simduid_htab, fun);
 
   /*  ----------- Analyze loops. -----------  */
+  enable_ranger (fun);
 
   /* If some loop was duplicated, it gets bigger number
      than all previously defined loops.  This fact allows us to run
@@ -1341,6 +1343,7 @@ pass_vectorize::execute (function *fun)
                      num_vectorized_loops);
 
   /*  ----------- Finalize. -----------  */
+  disable_ranger (fun);
 
   if (any_ifcvt_loops)
     for (i = 1; i < number_of_loops (fun); i++)
-- 
2.51.0

Reply via email to