I have realized I failed to update the SCC scheduling part for
schedule verification. So this properly honors the scheduling
result for SCC components and makes sure to set the result
on all components to make it accessible to all possible further
entries to the SCC.
No test coverage yet.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
PR tree-optimization/127018
* tree-vect-slp.cc (vect_schedule_scc): For SCCs of
multiple components update the scheduling state and
propagate it to all nodes.
---
gcc/tree-vect-slp.cc | 54 +++++++++++++++++++++++++-------------------
1 file changed, 31 insertions(+), 23 deletions(-)
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 0ee1c1cc311..0e74ac00075 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -12598,6 +12598,9 @@ vect_schedule_scc (vec_info *vinfo, slp_tree node,
slp_instance instance,
for only back-reachable nodes). But it's simpler to just
iterate and schedule those that are ready. */
unsigned todo = stack.length () - last_idx;
+ auto_vec<slp_tree, 4> saved_scc (todo);
+ memcpy (saved_scc.address (), stack.address ()[last_idx + 1],
+ sizeof (slp_tree) * todo);
do
{
for (int idx = stack.length () - 1; idx >= last_idx; --idx)
@@ -12609,31 +12612,32 @@ vect_schedule_scc (vec_info *vinfo, slp_tree node,
slp_instance instance,
&& is_a <gphi *> (SLP_TREE_REPRESENTATIVE
(entry)->stmt));
bool ready = !phi;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (entry), i, child)
- if (!child)
- {
- gcc_assert (phi);
- ready = true;
- break;
- }
- else if (scc_info.get (child)->on_stack)
- {
- if (!phi)
- {
- ready = false;
- break;
- }
- }
- else
- {
- if (phi)
- {
- ready = true;
- break;
- }
- }
+ if (!child)
+ {
+ gcc_assert (phi);
+ ready = true;
+ break;
+ }
+ else if (scc_info.get (child)->on_stack)
+ {
+ if (!phi)
+ {
+ ready = false;
+ break;
+ }
+ }
+ else
+ {
+ if (phi)
+ {
+ ready = true;
+ break;
+ }
+ }
if (ready)
{
- vect_schedule_slp_node (vinfo, entry, instance, place_only);
+ res &= vect_schedule_slp_node (vinfo, entry, instance,
+ place_only);
scc_info.get (entry)->on_stack = false;
stack[idx] = NULL;
todo--;
@@ -12644,6 +12648,10 @@ vect_schedule_scc (vec_info *vinfo, slp_tree node,
slp_instance instance,
}
while (todo != 0);
+ /* Push the scheduling result to all of the SCC. */
+ for (slp_tree entry : saved_scc)
+ scc_info.get (entry)->res = res;
+
/* Pop the SCC. */
stack.truncate (last_idx);
}
--
2.51.0