]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Enhance -fopt-info-vec vectorized loop diagnostic
authorRichard Biener <rguenther@suse.de>
Wed, 14 May 2025 14:45:08 +0000 (16:45 +0200)
committerRichard Biener <rguenther@suse.de>
Thu, 15 May 2025 06:05:50 +0000 (08:05 +0200)
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.

gcc/testsuite/gcc.target/i386/pr110310.c
gcc/tree-vectorizer.cc

index dce388aeb206fec98093af3d16ff23bb56135d04..60564393a2c96ebed6ac79572254b516077f0072 100644 (file)
@@ -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" } } */
index 447f882c5184e3eeef7c5d88173356b4cfb954ba..2f77e46ba99279d39f9c9d6f3557f3b67ac8ff3a 100644 (file)
@@ -1026,10 +1026,19 @@ vect_transform_loops (hash_table<simduid_to_vf> *&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,