Avoid uninitialized diagnostic in vect_get_num_copies_for_invariant The following avoids storing garbage to *excess_elts when returning false from vect_get_num_copies_for_invariant. * tree-vect-slp.cc (vect_get_num_copies_for_invariant): Refactor to avoid accessing rem when we will return false.
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index 06db2f2..59148da 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc
@@ -8944,12 +8944,14 @@ tree vectype = SLP_TREE_VECTYPE (node); uint64_t rem; - bool res = (can_div_away_from_zero_p (vf, TYPE_VECTOR_SUBPARTS (vectype), - nvectors) - && ((TYPE_VECTOR_SUBPARTS (vectype) * *nvectors - vf) - .is_constant (&rem))); - *excess_elts = rem; - return res; + if (can_div_away_from_zero_p (vf, TYPE_VECTOR_SUBPARTS (vectype), + nvectors) + && (TYPE_VECTOR_SUBPARTS (vectype) * *nvectors - vf) .is_constant (&rem)) + { + *excess_elts = rem; + return true; + } + return false; } /* Compute the prologue cost for invariant or constant operands represented