vect: Move suggested_unroll_factor applying [PR105940]
authorKewen Lin <linkw@linux.ibm.com>
Tue, 14 Jun 2022 05:57:01 +0000 (00:57 -0500)
committerKewen Lin <linkw@linux.ibm.com>
Thu, 23 Jun 2022 01:57:41 +0000 (20:57 -0500)
commitb3200ac82fd5aed39293a54e0e83258bb6caa600
treee792dd4be0ed4f305a6edc734de639d6284445f8
parent29b8b21f40392d9662e057177dd9e41af36499bf
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)
gcc/tree-vect-loop.cc