The following avoids storing garbage to *excess_elts when returning
false from vect_get_num_copies_for_invariant.
Bootstrap/regtest running on x86_64-unknown-linux-gnu.
* tree-vect-slp.cc (vect_get_num_copies_for_invariant):
Refactor to avoid accessing rem when we will return false.
---
gcc/tree-vect-slp.cc | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 52c623f75a2..8564422028b 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -8956,12 +8956,14 @@ vect_get_num_copies_for_invariant (vec_info *vinfo,
slp_tree node,
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
--
2.51.0