< prev index next >

src/hotspot/share/opto/ifnode.cpp

Print this page




1533     } // End for each child of a projection
1534 
1535     igvn->remove_dead_node(ifp);
1536   } // End for each IfTrue/IfFalse child of If
1537 
1538   // Kill the IfNode
1539   igvn->remove_dead_node(this);
1540 
1541   // Must return either the original node (now dead) or a new node
1542   // (Do not return a top here, since that would break the uniqueness of top.)
1543   return new ConINode(TypeInt::ZERO);
1544 }
1545 
1546 Node* IfNode::search_identical(int dist) {
1547   // Setup to scan up the CFG looking for a dominating test
1548   Node* dom = in(0);
1549   Node* prev_dom = this;
1550   int op = Opcode();
1551   // Search up the dominator tree for an If with an identical test
1552   while (dom->Opcode() != op    ||  // Not same opcode?
1553          dom->in(1)    != in(1) ||  // Not same input 1?
1554          (req() == 3 && dom->in(2) != in(2)) || // Not same input 2?
1555          prev_dom->in(0) != dom) {  // One path of test does not dominate?
1556     if (dist < 0) return NULL;
1557 
1558     dist--;
1559     prev_dom = dom;
1560     dom = up_one_dom(dom);
1561     if (!dom) return NULL;
1562   }
1563 
1564   // Check that we did not follow a loop back to ourselves
1565   if (this == dom) {
1566     return NULL;
1567   }
1568 
1569 #ifndef PRODUCT
1570   if (dist > 2) { // Add to count of NULL checks elided
1571     explicit_null_checks_elided++;
1572   }
1573 #endif
1574 




1533     } // End for each child of a projection
1534 
1535     igvn->remove_dead_node(ifp);
1536   } // End for each IfTrue/IfFalse child of If
1537 
1538   // Kill the IfNode
1539   igvn->remove_dead_node(this);
1540 
1541   // Must return either the original node (now dead) or a new node
1542   // (Do not return a top here, since that would break the uniqueness of top.)
1543   return new ConINode(TypeInt::ZERO);
1544 }
1545 
1546 Node* IfNode::search_identical(int dist) {
1547   // Setup to scan up the CFG looking for a dominating test
1548   Node* dom = in(0);
1549   Node* prev_dom = this;
1550   int op = Opcode();
1551   // Search up the dominator tree for an If with an identical test
1552   while (dom->Opcode() != op    ||  // Not same opcode?
1553          dom->in(1) != in(1)    ||  // Not same input 1?

1554          prev_dom->in(0) != dom) {  // One path of test does not dominate?
1555     if (dist < 0) return NULL;
1556 
1557     dist--;
1558     prev_dom = dom;
1559     dom = up_one_dom(dom);
1560     if (!dom) return NULL;
1561   }
1562 
1563   // Check that we did not follow a loop back to ourselves
1564   if (this == dom) {
1565     return NULL;
1566   }
1567 
1568 #ifndef PRODUCT
1569   if (dist > 2) { // Add to count of NULL checks elided
1570     explicit_null_checks_elided++;
1571   }
1572 #endif
1573 


< prev index next >