Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/loopnode.cpp @ 3936:2c24ef16533d
7035946: Up to 15% regression on JDK 7 b136 vs b135 on specjvm2008.crypto.rsa on x64
Summary: Revert changes which caused regression.
Reviewed-by: never
author | kvn |
---|---|
date | Fri, 09 Sep 2011 13:47:11 -0700 |
parents | 6987871cfb9b |
children | 670a74b863fc |
comparison
equal
deleted
inserted
replaced
3935:5257f8e66b40 | 3936:2c24ef16533d |
---|---|
580 loop->_tail = iftrue; | 580 loop->_tail = iftrue; |
581 } | 581 } |
582 | 582 |
583 // Build a canonical trip test. | 583 // Build a canonical trip test. |
584 // Clone code, as old values may be in use. | 584 // Clone code, as old values may be in use. |
585 Node* nphi = PhiNode::make(x, init_trip, TypeInt::INT); | |
586 nphi = _igvn.register_new_node_with_optimizer(nphi); | |
587 set_ctrl(nphi, get_ctrl(phi)); | |
588 | |
589 incr = incr->clone(); | 585 incr = incr->clone(); |
590 incr->set_req(1,nphi); | 586 incr->set_req(1,phi); |
591 incr->set_req(2,stride); | 587 incr->set_req(2,stride); |
592 incr = _igvn.register_new_node_with_optimizer(incr); | 588 incr = _igvn.register_new_node_with_optimizer(incr); |
593 set_early_ctrl( incr ); | 589 set_early_ctrl( incr ); |
594 | 590 _igvn.hash_delete(phi); |
595 nphi->set_req(LoopNode::LoopBackControl, incr); | 591 phi->set_req_X( LoopNode::LoopBackControl, incr, &_igvn ); |
596 _igvn.replace_node(phi, nphi); | 592 |
597 phi = nphi->as_Phi(); | 593 // If phi type is more restrictive than Int, raise to |
598 | 594 // Int to prevent (almost) infinite recursion in igvn |
595 // which can only handle integer types for constants or minint..maxint. | |
596 if (!TypeInt::INT->higher_equal(phi->bottom_type())) { | |
597 Node* nphi = PhiNode::make(phi->in(0), phi->in(LoopNode::EntryControl), TypeInt::INT); | |
598 nphi->set_req(LoopNode::LoopBackControl, phi->in(LoopNode::LoopBackControl)); | |
599 nphi = _igvn.register_new_node_with_optimizer(nphi); | |
600 set_ctrl(nphi, get_ctrl(phi)); | |
601 _igvn.replace_node(phi, nphi); | |
602 phi = nphi->as_Phi(); | |
603 } | |
599 cmp = cmp->clone(); | 604 cmp = cmp->clone(); |
600 cmp->set_req(1,incr); | 605 cmp->set_req(1,incr); |
601 cmp->set_req(2,limit); | 606 cmp->set_req(2,limit); |
602 cmp = _igvn.register_new_node_with_optimizer(cmp); | 607 cmp = _igvn.register_new_node_with_optimizer(cmp); |
603 set_ctrl(cmp, iff->in(0)); | 608 set_ctrl(cmp, iff->in(0)); |
1616 return; // Dead loop? | 1621 return; // Dead loop? |
1617 Node *init = cl->init_trip(); | 1622 Node *init = cl->init_trip(); |
1618 Node *phi = cl->phi(); | 1623 Node *phi = cl->phi(); |
1619 int stride_con = cl->stride_con(); | 1624 int stride_con = cl->stride_con(); |
1620 | 1625 |
1621 PhaseGVN *gvn = &_igvn; | |
1622 | |
1623 // Visit all children, looking for Phis | 1626 // Visit all children, looking for Phis |
1624 for (DUIterator i = cl->outs(); cl->has_out(i); i++) { | 1627 for (DUIterator i = cl->outs(); cl->has_out(i); i++) { |
1625 Node *out = cl->out(i); | 1628 Node *out = cl->out(i); |
1626 // Look for other phis (secondary IVs). Skip dead ones | 1629 // Look for other phis (secondary IVs). Skip dead ones |
1627 if (!out->is_Phi() || out == phi || !has_node(out)) | 1630 if (!out->is_Phi() || out == phi || !has_node(out)) |
1653 // where +/-1 is the common case, but other integer multiples are | 1656 // where +/-1 is the common case, but other integer multiples are |
1654 // also easy to handle. | 1657 // also easy to handle. |
1655 int ratio_con = stride_con2/stride_con; | 1658 int ratio_con = stride_con2/stride_con; |
1656 | 1659 |
1657 if ((ratio_con * stride_con) == stride_con2) { // Check for exact | 1660 if ((ratio_con * stride_con) == stride_con2) { // Check for exact |
1661 #ifndef PRODUCT | |
1662 if (TraceLoopOpts) { | |
1663 tty->print("Parallel IV: %d ", phi2->_idx); | |
1664 loop->dump_head(); | |
1665 } | |
1666 #endif | |
1658 // Convert to using the trip counter. The parallel induction | 1667 // Convert to using the trip counter. The parallel induction |
1659 // variable differs from the trip counter by a loop-invariant | 1668 // variable differs from the trip counter by a loop-invariant |
1660 // amount, the difference between their respective initial values. | 1669 // amount, the difference between their respective initial values. |
1661 // It is scaled by the 'ratio_con'. | 1670 // It is scaled by the 'ratio_con'. |
1662 // Perform local Ideal transformation since in most cases ratio == 1. | |
1663 Node* ratio = _igvn.intcon(ratio_con); | 1671 Node* ratio = _igvn.intcon(ratio_con); |
1664 set_ctrl(ratio, C->root()); | 1672 set_ctrl(ratio, C->root()); |
1665 Node* hook = new (C, 3) Node(3); | 1673 Node* ratio_init = new (C, 3) MulINode(init, ratio); |
1666 Node* ratio_init = gvn->transform(new (C, 3) MulINode(init, ratio)); | 1674 _igvn.register_new_node_with_optimizer(ratio_init, init); |
1667 hook->init_req(0, ratio_init); | 1675 set_early_ctrl(ratio_init); |
1668 Node* diff = gvn->transform(new (C, 3) SubINode(init2, ratio_init)); | 1676 Node* diff = new (C, 3) SubINode(init2, ratio_init); |
1669 hook->init_req(1, diff); | 1677 _igvn.register_new_node_with_optimizer(diff, init2); |
1670 Node* ratio_idx = gvn->transform(new (C, 3) MulINode(phi, ratio)); | 1678 set_early_ctrl(diff); |
1671 hook->init_req(2, ratio_idx); | 1679 Node* ratio_idx = new (C, 3) MulINode(phi, ratio); |
1672 Node* add = gvn->transform(new (C, 3) AddINode(ratio_idx, diff)); | 1680 _igvn.register_new_node_with_optimizer(ratio_idx, phi); |
1673 set_subtree_ctrl(add); | 1681 set_ctrl(ratio_idx, cl); |
1682 Node* add = new (C, 3) AddINode(ratio_idx, diff); | |
1683 _igvn.register_new_node_with_optimizer(add); | |
1684 set_ctrl(add, cl); | |
1674 _igvn.replace_node( phi2, add ); | 1685 _igvn.replace_node( phi2, add ); |
1675 // Free up intermediate goo | |
1676 _igvn.remove_dead_node(hook); | |
1677 // Sometimes an induction variable is unused | 1686 // Sometimes an induction variable is unused |
1678 if (add->outcnt() == 0) { | 1687 if (add->outcnt() == 0) { |
1679 _igvn.remove_dead_node(add); | 1688 _igvn.remove_dead_node(add); |
1680 } | 1689 } |
1681 --i; // deleted this phi; rescan starting with next position | 1690 --i; // deleted this phi; rescan starting with next position |