Skip to content

Commit 08f652a

Browse files
committed
8230062: assert(i == p->size()-1) failed: must be last element of the pack
Avoids vectorization of reduction chain in which an intermediate result is used. Reviewed-by: roland, thartmann
1 parent 03c764c commit 08f652a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/hotspot/share/opto/superword.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2045,12 +2045,11 @@ bool SuperWord::profitable(Node_List* p) {
20452045
for (uint k = 0; k < use->req(); k++) {
20462046
Node* n = use->in(k);
20472047
if (def == n) {
2048-
// reductions should only have a Phi use at the the loop
2049-
// head and out of loop uses
2048+
// Reductions should only have a Phi use at the loop head or a non-phi use
2049+
// outside of the loop if it is the last element of the pack (e.g. SafePoint).
20502050
if (def->is_reduction() &&
20512051
((use->is_Phi() && use->in(0) == _lpt->_head) ||
2052-
!_lpt->is_member(_phase->get_loop(_phase->ctrl_or_self(use))))) {
2053-
assert(i == p->size()-1, "must be last element of the pack");
2052+
(!_lpt->is_member(_phase->get_loop(_phase->ctrl_or_self(use))) && i == p->size()-1))) {
20542053
continue;
20552054
}
20562055
if (!is_vector_use(use, k)) {

0 commit comments

Comments
 (0)