On Mon, 12 May 2025, Richard Sandiford wrote: > Richard Biener <rguent...@suse.de> writes: > > 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? > > Nothing constructive, just: thanks for doing this. It was also on my > long-term wish list (but with no realistic prospect of ever being done, > if it had been up to me).
Testing revealed some issues and as said I have to double check the match.pd pattern guards. So I've put this on hold for the moment, but I do plan to eventually go forward with this during stage1 - I might even move it a bit more early, right to where we lower complex & bitint so DOM will catch up CSE opportunities. Richard. > Richard > > > 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); > -- Richard Biener <rguent...@suse.de> SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)