< prev index next >

src/hotspot/share/opto/ifnode.cpp

Print this page




1488     } // End for each child of a projection
1489 
1490     igvn->remove_dead_node(ifp);
1491   } // End for each IfTrue/IfFalse child of If
1492 
1493   // Kill the IfNode
1494   igvn->remove_dead_node(this);
1495 
1496   // Must return either the original node (now dead) or a new node
1497   // (Do not return a top here, since that would break the uniqueness of top.)
1498   return new ConINode(TypeInt::ZERO);
1499 }
1500 
1501 Node* IfNode::search_identical(int dist) {
1502   // Setup to scan up the CFG looking for a dominating test
1503   Node* dom = in(0);
1504   Node* prev_dom = this;
1505   int op = Opcode();
1506   // Search up the dominator tree for an If with an identical test
1507   while (dom->Opcode() != op    ||  // Not same opcode?
1508          dom->in(1)    != in(1) ||  // Not same input 1?
1509          (req() == 3 && dom->in(2) != in(2)) || // Not same input 2?
1510          prev_dom->in(0) != dom) {  // One path of test does not dominate?
1511     if (dist < 0) return NULL;
1512 
1513     dist--;
1514     prev_dom = dom;
1515     dom = up_one_dom(dom);
1516     if (!dom) return NULL;
1517   }
1518 
1519   // Check that we did not follow a loop back to ourselves
1520   if (this == dom) {
1521     return NULL;
1522   }
1523 
1524 #ifndef PRODUCT
1525   if (dist > 2) { // Add to count of NULL checks elided
1526     explicit_null_checks_elided++;
1527   }
1528 #endif
1529 




1488     } // End for each child of a projection
1489 
1490     igvn->remove_dead_node(ifp);
1491   } // End for each IfTrue/IfFalse child of If
1492 
1493   // Kill the IfNode
1494   igvn->remove_dead_node(this);
1495 
1496   // Must return either the original node (now dead) or a new node
1497   // (Do not return a top here, since that would break the uniqueness of top.)
1498   return new ConINode(TypeInt::ZERO);
1499 }
1500 
1501 Node* IfNode::search_identical(int dist) {
1502   // Setup to scan up the CFG looking for a dominating test
1503   Node* dom = in(0);
1504   Node* prev_dom = this;
1505   int op = Opcode();
1506   // Search up the dominator tree for an If with an identical test
1507   while (dom->Opcode() != op    ||  // Not same opcode?
1508          dom->in(1) != in(1)    ||  // Not same input 1?

1509          prev_dom->in(0) != dom) {  // One path of test does not dominate?
1510     if (dist < 0) return NULL;
1511 
1512     dist--;
1513     prev_dom = dom;
1514     dom = up_one_dom(dom);
1515     if (!dom) return NULL;
1516   }
1517 
1518   // Check that we did not follow a loop back to ourselves
1519   if (this == dom) {
1520     return NULL;
1521   }
1522 
1523 #ifndef PRODUCT
1524   if (dist > 2) { // Add to count of NULL checks elided
1525     explicit_null_checks_elided++;
1526   }
1527 #endif
1528 


< prev index next >