8230062: assert(i == p->size()-1) failed: must be last element of the pack
Summary: Avoids vectorization of reduction chain in which an intermediate result is used.
Reviewed-by: roland, thartmann
--- a/src/hotspot/share/opto/superword.cpp Sat Sep 28 17:52:07 2019 -0400
+++ b/src/hotspot/share/opto/superword.cpp Mon Sep 30 09:29:10 2019 +0200
@@ -2045,12 +2045,11 @@
for (uint k = 0; k < use->req(); k++) {
Node* n = use->in(k);
if (def == n) {
- // reductions should only have a Phi use at the the loop
- // head and out of loop uses
+ // Reductions should only have a Phi use at the loop head or a non-phi use
+ // outside of the loop if it is the last element of the pack (e.g. SafePoint).
if (def->is_reduction() &&
((use->is_Phi() && use->in(0) == _lpt->_head) ||
- !_lpt->is_member(_phase->get_loop(_phase->ctrl_or_self(use))))) {
- assert(i == p->size()-1, "must be last element of the pack");
+ (!_lpt->is_member(_phase->get_loop(_phase->ctrl_or_self(use))) && i == p->size()-1))) {
continue;
}
if (!is_vector_use(use, k)) {