comparison src/share/vm/opto/cfgnode.cpp @ 1013:ce590301ae2a

6889300: assert(i != k || is_new || i->outcnt() > 0, "don't return dead nodes") Summary: PhiNode::Ideal() should return TOP for Phi node with no users. Reviewed-by: never, jrose
author kvn
date Tue, 13 Oct 2009 22:32:31 -0700
parents 15bbd3f505c0
children ae4032fb0a5b eb79484f795f
comparison
equal deleted inserted replaced
1012:5f29a958a545 1013:ce590301ae2a
1529 // This means we have to use type_or_null to defend against untyped regions. 1529 // This means we have to use type_or_null to defend against untyped regions.
1530 if( phase->type_or_null(r) == Type::TOP ) // Dead code? 1530 if( phase->type_or_null(r) == Type::TOP ) // Dead code?
1531 return NULL; // No change 1531 return NULL; // No change
1532 1532
1533 Node *top = phase->C->top(); 1533 Node *top = phase->C->top();
1534 bool new_phi = (outcnt() == 0); // transforming new Phi
1535 assert(!can_reshape || !new_phi, "for igvn new phi should be hooked");
1534 1536
1535 // The are 2 situations when only one valid phi's input is left 1537 // The are 2 situations when only one valid phi's input is left
1536 // (in addition to Region input). 1538 // (in addition to Region input).
1537 // One: region is not loop - replace phi with this input. 1539 // One: region is not loop - replace phi with this input.
1538 // Two: region is loop - replace phi with top since this data path is dead 1540 // Two: region is loop - replace phi with top since this data path is dead
1546 if (n != top) { // Not already top? 1548 if (n != top) { // Not already top?
1547 set_req(j, top); // Nuke it down 1549 set_req(j, top); // Nuke it down
1548 progress = this; // Record progress 1550 progress = this; // Record progress
1549 } 1551 }
1550 } 1552 }
1553 }
1554
1555 if (can_reshape && outcnt() == 0) {
1556 // set_req() above may kill outputs if Phi is referenced
1557 // only by itself on the dead (top) control path.
1558 return top;
1551 } 1559 }
1552 1560
1553 Node* uin = unique_input(phase); 1561 Node* uin = unique_input(phase);
1554 if (uin == top) { // Simplest case: no alive inputs. 1562 if (uin == top) { // Simplest case: no alive inputs.
1555 if (can_reshape) // IGVN transformation 1563 if (can_reshape) // IGVN transformation
1682 // compress paths and change unreachable cycles to TOP 1690 // compress paths and change unreachable cycles to TOP
1683 // If not, we can update the input infinitely along a MergeMem cycle 1691 // If not, we can update the input infinitely along a MergeMem cycle
1684 // Equivalent code is in MemNode::Ideal_common 1692 // Equivalent code is in MemNode::Ideal_common
1685 Node *m = phase->transform(n); 1693 Node *m = phase->transform(n);
1686 if (outcnt() == 0) { // Above transform() may kill us! 1694 if (outcnt() == 0) { // Above transform() may kill us!
1687 progress = phase->C->top(); 1695 return top;
1688 break;
1689 } 1696 }
1690 // If transformed to a MergeMem, get the desired slice 1697 // If transformed to a MergeMem, get the desired slice
1691 // Otherwise the returned node represents memory for every slice 1698 // Otherwise the returned node represents memory for every slice
1692 Node *new_mem = (m->is_MergeMem()) ? 1699 Node *new_mem = (m->is_MergeMem()) ?
1693 m->as_MergeMem()->memory_at(alias_idx) : m; 1700 m->as_MergeMem()->memory_at(alias_idx) : m;