From: Richard Biener Date: Wed, 14 May 2025 14:45:08 +0000 (+0200) Subject: Enhance -fopt-info-vec vectorized loop diagnostic X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=af7b84d0d02ffa23e4843e9555a888c9e80bd9b5;p=thirdparty%2Fgcc.git Enhance -fopt-info-vec vectorized loop diagnostic The following includes whether we vectorize an epilogue, whether we use loop masking and what vectorization factor (unroll factor) we use. So it's now t.c:4:21: optimized: loop vectorized using 64 byte vectors and unroll factor 32 t.c:4:21: optimized: epilogue loop vectorized using masked 64 byte vectors and unroll factor 32 for a masked epilogue with AVX512 and HImode data for example. Rather than t.c:4:21: optimized: loop vectorized using 64 byte vectors t.c:4:21: optimized: loop vectorized using 64 byte vectors I verified we don't translate opt-info messages and thus excessive use of %s to compose the strings should be OK. * tree-vectorizer.cc (vect_transform_loops): When diagnosing a vectorized loop indicate whether we vectorized an epilogue, whether we used masked vectors and what unroll factor was used. * gcc.target/i386/pr110310.c: Adjust. --- diff --git a/gcc/testsuite/gcc.target/i386/pr110310.c b/gcc/testsuite/gcc.target/i386/pr110310.c index dce388aeb20..60564393a2c 100644 --- a/gcc/testsuite/gcc.target/i386/pr110310.c +++ b/gcc/testsuite/gcc.target/i386/pr110310.c @@ -9,5 +9,5 @@ void foo (int * __restrict a, int *b) /* We should vectorize the main loop with AVX512 and the epilog with SSE. */ -/* { dg-final { scan-tree-dump "optimized: loop vectorized using 64 byte vectors" "vect" } } */ -/* { dg-final { scan-tree-dump "optimized: loop vectorized using 16 byte vectors" "vect" } } */ +/* { dg-final { scan-tree-dump "loop vectorized using 64 byte vectors" "vect" } } */ +/* { dg-final { scan-tree-dump "loop vectorized using 16 byte vectors" "vect" } } */ diff --git a/gcc/tree-vectorizer.cc b/gcc/tree-vectorizer.cc index 447f882c518..2f77e46ba99 100644 --- a/gcc/tree-vectorizer.cc +++ b/gcc/tree-vectorizer.cc @@ -1026,10 +1026,19 @@ vect_transform_loops (hash_table *&simduid_to_vf_htab, { if (GET_MODE_SIZE (loop_vinfo->vector_mode).is_constant (&bytes)) dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, - "loop vectorized using %wu byte vectors\n", bytes); + "%sloop vectorized using %s%wu byte vectors and" + " unroll factor %u\n", + LOOP_VINFO_EPILOGUE_P (loop_vinfo) + ? "epilogue " : "", + LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo) + ? "masked " : "", bytes, + (unsigned int) LOOP_VINFO_VECT_FACTOR + (loop_vinfo).to_constant ()); else dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location, - "loop vectorized using variable length vectors\n"); + "%sloop vectorized using variable length vectors\n", + LOOP_VINFO_EPILOGUE_P (loop_vinfo) + ? "epilogue " : ""); } loop_p new_loop = vect_transform_loop (loop_vinfo,