8134739: compiler/loopopts/superword/TestVectorizationWithInvariant crashes in loop opts jdk8u242-b01

Tue, 08 Oct 2019 15:38:35 +0200

author
thartmann
date
Tue, 08 Oct 2019 15:38:35 +0200
changeset 9776
ce42ae95d4d6
parent 9775
9b865b281711
child 9777
ed8892ef0a8d
child 9778
bf6ea7319424

8134739: compiler/loopopts/superword/TestVectorizationWithInvariant crashes in loop opts
Summary: Bail out of superword optimization if loop was removed (i.e., if zero-trip Opaque1Node was removed).
Reviewed-by: kvn, roland

src/share/vm/opto/loopnode.hpp file | annotate | diff | comparison | revisions
src/share/vm/opto/superword.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/opto/loopnode.hpp	Fri Feb 27 11:41:42 2015 +0300
     1.2 +++ b/src/share/vm/opto/loopnode.hpp	Tue Oct 08 15:38:35 2019 +0200
     1.3 @@ -279,6 +279,7 @@
     1.4      if (iv_phi == NULL) {
     1.5        return NULL;
     1.6      }
     1.7 +    assert(iv_phi->is_Phi(), "should be PhiNode");
     1.8      Node *ln = iv_phi->in(0);
     1.9      if (ln->is_CountedLoop() && ln->as_CountedLoop()->loopexit() == this) {
    1.10        return (CountedLoopNode*)ln;
     2.1 --- a/src/share/vm/opto/superword.cpp	Fri Feb 27 11:41:42 2015 +0300
     2.2 +++ b/src/share/vm/opto/superword.cpp	Tue Oct 08 15:38:35 2019 +0200
     2.3 @@ -2208,15 +2208,25 @@
     2.4  
     2.5  //----------------------------get_pre_loop_end---------------------------
     2.6  // Find pre loop end from main loop.  Returns null if none.
     2.7 -CountedLoopEndNode* SuperWord::get_pre_loop_end(CountedLoopNode *cl) {
     2.8 -  Node *ctrl = cl->in(LoopNode::EntryControl);
     2.9 +CountedLoopEndNode* SuperWord::get_pre_loop_end(CountedLoopNode* cl) {
    2.10 +  Node* ctrl = cl->in(LoopNode::EntryControl);
    2.11    if (!ctrl->is_IfTrue() && !ctrl->is_IfFalse()) return NULL;
    2.12 -  Node *iffm = ctrl->in(0);
    2.13 +  Node* iffm = ctrl->in(0);
    2.14    if (!iffm->is_If()) return NULL;
    2.15 -  Node *p_f = iffm->in(0);
    2.16 +  Node* bolzm = iffm->in(1);
    2.17 +  if (!bolzm->is_Bool()) return NULL;
    2.18 +  Node* cmpzm = bolzm->in(1);
    2.19 +  if (!cmpzm->is_Cmp()) return NULL;
    2.20 +  Node* opqzm = cmpzm->in(2);
    2.21 +  // Can not optimize a loop if zero-trip Opaque1 node is optimized
    2.22 +  // away and then another round of loop opts attempted.
    2.23 +  if (opqzm->Opcode() != Op_Opaque1) {
    2.24 +    return NULL;
    2.25 +  }
    2.26 +  Node* p_f = iffm->in(0);
    2.27    if (!p_f->is_IfFalse()) return NULL;
    2.28    if (!p_f->in(0)->is_CountedLoopEnd()) return NULL;
    2.29 -  CountedLoopEndNode *pre_end = p_f->in(0)->as_CountedLoopEnd();
    2.30 +  CountedLoopEndNode* pre_end = p_f->in(0)->as_CountedLoopEnd();
    2.31    CountedLoopNode* loop_node = pre_end->loopnode();
    2.32    if (loop_node == NULL || !loop_node->is_pre_loop()) return NULL;
    2.33    return pre_end;

mercurial