summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKewen Lin <linkw@linux.ibm.com>2022-06-14 00:57:01 -0500
committerKewen Lin <linkw@linux.ibm.com>2022-06-22 20:57:41 -0500
commitb3200ac82fd5aed39293a54e0e83258bb6caa600 (patch)
treee792dd4be0ed4f305a6edc734de639d6284445f8
parentDaily bump. (diff)
downloadgcc-b3200ac82fd5aed39293a54e0e83258bb6caa600.tar.gz
gcc-b3200ac82fd5aed39293a54e0e83258bb6caa600.tar.bz2
gcc-b3200ac82fd5aed39293a54e0e83258bb6caa600.tar.xz
vect: Move suggested_unroll_factor applying [PR105940]
As PR105940 shown, when rs6000 port tries to assign m_suggested_unroll_factor by 4 or so, there will be ICE on: exact_div (LOOP_VINFO_VECT_FACTOR (loop_vinfo), loop_vinfo->suggested_unroll_factor); In function vect_analyze_loop_2, the current place of suggested_unroll_factor applying can't guarantee it's applied for all cases. As the case shows, vectorizer could retry with SLP forced off, the vf is reset by saved_vectorization_factor which isn't applied with suggested_unroll_factor before. It means it can end up with one vf which neglects suggested_unroll_factor. I think it's off design, we should move the applying of suggested_unroll_factor after start_over. PR tree-optimization/105940 gcc/ChangeLog: * tree-vect-loop.cc (vect_analyze_loop_2): Move the place of applying suggested_unroll_factor after start_over. (cherry picked from commit f907cf4c07cf51863dadbe90894e2ae3382bada5)
-rw-r--r--gcc/tree-vect-loop.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index f53a634a390..aed14e9b686 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -2388,15 +2388,15 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo, bool &fatal,
2388 set of rgroups. */ 2388 set of rgroups. */
2389 gcc_assert (LOOP_VINFO_MASKS (loop_vinfo).is_empty ()); 2389 gcc_assert (LOOP_VINFO_MASKS (loop_vinfo).is_empty ());
2390 2390
2391 /* This is the point where we can re-start analysis with SLP forced off. */
2392start_over:
2393
2391 /* Apply the suggested unrolling factor, this was determined by the backend 2394 /* Apply the suggested unrolling factor, this was determined by the backend
2392 during finish_cost the first time we ran the analyzis for this 2395 during finish_cost the first time we ran the analyzis for this
2393 vector mode. */ 2396 vector mode. */
2394 if (loop_vinfo->suggested_unroll_factor > 1) 2397 if (loop_vinfo->suggested_unroll_factor > 1)
2395 LOOP_VINFO_VECT_FACTOR (loop_vinfo) *= loop_vinfo->suggested_unroll_factor; 2398 LOOP_VINFO_VECT_FACTOR (loop_vinfo) *= loop_vinfo->suggested_unroll_factor;
2396 2399
2397 /* This is the point where we can re-start analysis with SLP forced off. */
2398start_over:
2399
2400 /* Now the vectorization factor is final. */ 2400 /* Now the vectorization factor is final. */
2401 poly_uint64 vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo); 2401 poly_uint64 vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
2402 gcc_assert (known_ne (vectorization_factor, 0U)); 2402 gcc_assert (known_ne (vectorization_factor, 0U));