8230062: assert(i == p->size()-1) failed: must be last element of the pack
authorchagedorn
Mon, 30 Sep 2019 09:29:10 +0200
changeset 58393 0df9370fee29
parent 58390 4107e5a422b6
child 58394 b1c3d24553e0
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
src/hotspot/share/opto/superword.cpp
--- 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)) {