src/share/vm/opto/loopTransform.cpp
Print this page
rev 4329 : [mq]: JDK-8009181
*** 886,895 ****
--- 886,896 ----
// Find common pieces of the loop being guarded with pre & post loops
CountedLoopNode *main_head = loop->_head->as_CountedLoop();
assert( main_head->is_normal_loop(), "" );
CountedLoopEndNode *main_end = main_head->loopexit();
+ guarantee(main_end != NULL, "no loop exit node");
assert( main_end->outcnt() == 2, "1 true, 1 false path only" );
uint dd_main_head = dom_depth(main_head);
uint max = main_head->outcnt();
Node *pre_header= main_head->in(LoopNode::EntryControl);
*** 2552,2568 ****
// store related values are ok
ok.set(store->_idx);
ok.set(store->in(MemNode::Memory)->_idx);
// Loop structure is ok
ok.set(head->_idx);
! ok.set(head->loopexit()->_idx);
ok.set(head->phi()->_idx);
ok.set(head->incr()->_idx);
! ok.set(head->loopexit()->cmp_node()->_idx);
! ok.set(head->loopexit()->in(1)->_idx);
// Address elements are ok
if (con) ok.set(con->_idx);
if (shift) ok.set(shift->_idx);
if (conv) ok.set(conv->_idx);
--- 2553,2572 ----
// store related values are ok
ok.set(store->_idx);
ok.set(store->in(MemNode::Memory)->_idx);
+ CountedLoopEndNode* loop_exit = head->loopexit();
+ guarantee(loop_exit != NULL, "no loop exit node");
+
// Loop structure is ok
ok.set(head->_idx);
! ok.set(head_exit->_idx);
ok.set(head->phi()->_idx);
ok.set(head->incr()->_idx);
! ok.set(loop_exit->cmp_node()->_idx);
! ok.set(loop_exit->in(1)->_idx);
// Address elements are ok
if (con) ok.set(con->_idx);
if (shift) ok.set(shift->_idx);
if (conv) ok.set(conv->_idx);
*** 2570,2580 ****
for (uint i = 0; msg == NULL && i < lpt->_body.size(); i++) {
Node* n = lpt->_body.at(i);
if (n->outcnt() == 0) continue; // Ignore dead
if (ok.test(n->_idx)) continue;
// Backedge projection is ok
! if (n->is_IfTrue() && n->in(0) == head->loopexit()) continue;
if (!n->is_AddP()) {
msg = "unhandled node";
msg_node = n;
break;
}
--- 2574,2584 ----
for (uint i = 0; msg == NULL && i < lpt->_body.size(); i++) {
Node* n = lpt->_body.at(i);
if (n->outcnt() == 0) continue; // Ignore dead
if (ok.test(n->_idx)) continue;
// Backedge projection is ok
! if (n->is_IfTrue() && n->in(0) == loop_exit) continue;
if (!n->is_AddP()) {
msg = "unhandled node";
msg_node = n;
break;
}
*** 2583,2593 ****
// Make sure no unexpected values are used outside the loop
for (uint i = 0; msg == NULL && i < lpt->_body.size(); i++) {
Node* n = lpt->_body.at(i);
// These values can be replaced with other nodes if they are used
// outside the loop.
! if (n == store || n == head->loopexit() || n == head->incr() || n == store->in(MemNode::Memory)) continue;
for (SimpleDUIterator iter(n); iter.has_next(); iter.next()) {
Node* use = iter.get();
if (!lpt->_body.contains(use)) {
msg = "node is used outside loop";
// lpt->_body.dump();
--- 2587,2597 ----
// Make sure no unexpected values are used outside the loop
for (uint i = 0; msg == NULL && i < lpt->_body.size(); i++) {
Node* n = lpt->_body.at(i);
// These values can be replaced with other nodes if they are used
// outside the loop.
! if (n == store || n == loop_exit || n == head->incr() || n == store->in(MemNode::Memory)) continue;
for (SimpleDUIterator iter(n); iter.has_next(); iter.next()) {
Node* use = iter.get();
if (!lpt->_body.contains(use)) {
msg = "node is used outside loop";
// lpt->_body.dump();