The following moves vector lowering to before vectorization - in fact
to before DCE/forwprop and CSE.  This gets us the chance to re-vectorize
the lowered form eventually.  Note that when the vectorizer learns to
handle vector code vector lowering should be likely integrated with
vectorization itself.

The main goal is to not have the gap between vectorization and
vector lowering where optimize_vectors_before_lowering_p is
still false.  Because that has the chance to mess up vector code
emitted by the vectorizer into a form that requires lowering
which can be quite inefficient.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Any comments on this part?  Note canonicalize_math_after_vectorization_p
says "Return true if math operations that are beneficial only after
vectorization should be canonicalized." but is keyed on vector lowering
having run.  That might need adjustment now, possibly adding another
property?

Thanks,
Richard.

        * passes.def (pass_lower_vector_ssa): Move from after loop
        optimizations to after the initial reassoc.
---
 gcc/passes.def | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/passes.def b/gcc/passes.def
index 3b251052e53..886023e57a0 100644
--- a/gcc/passes.def
+++ b/gcc/passes.def
@@ -254,6 +254,7 @@ along with GCC; see the file COPYING3.  If not see
         program and isolate those paths.  */
       NEXT_PASS (pass_isolate_erroneous_paths);
       NEXT_PASS (pass_reassoc, true /* early_p */);
+      NEXT_PASS (pass_lower_vector_ssa);
       NEXT_PASS (pass_dce);
       NEXT_PASS (pass_forwprop, /*last=*/false);
       NEXT_PASS (pass_phiopt, false /* early_p */);
@@ -334,7 +335,6 @@ along with GCC; see the file COPYING3.  If not see
          NEXT_PASS (pass_slp_vectorize);
       POP_INSERT_PASSES ()
       NEXT_PASS (pass_simduid_cleanup);
-      NEXT_PASS (pass_lower_vector_ssa);
       NEXT_PASS (pass_lower_switch);
       NEXT_PASS (pass_cse_sincos);
       NEXT_PASS (pass_cse_reciprocals);
-- 
2.43.0

Reply via email to