hotspot/src/share/vm/opto/phaseX.cpp
changeset 27708 8a8710cb8fc4
parent 26429 c5ca44ee3ce2
child 27910 8653c71aea40
equal deleted inserted replaced
27707:f7d26e5b8b5d 27708:8a8710cb8fc4
  1390       if (p != NULL) {
  1390       if (p != NULL) {
  1391         add_users_to_worklist0(p);
  1391         add_users_to_worklist0(p);
  1392       }
  1392       }
  1393     }
  1393     }
  1394 
  1394 
  1395     if( use->is_Cmp() ) {       // Enable CMP/BOOL optimization
  1395     uint use_op = use->Opcode();
       
  1396     if(use->is_Cmp()) {       // Enable CMP/BOOL optimization
  1396       add_users_to_worklist(use); // Put Bool on worklist
  1397       add_users_to_worklist(use); // Put Bool on worklist
  1397       // Look for the 'is_x2logic' pattern: "x ? : 0 : 1" and put the
       
  1398       // phi merging either 0 or 1 onto the worklist
       
  1399       if (use->outcnt() > 0) {
  1398       if (use->outcnt() > 0) {
  1400         Node* bol = use->raw_out(0);
  1399         Node* bol = use->raw_out(0);
  1401         if (bol->outcnt() > 0) {
  1400         if (bol->outcnt() > 0) {
  1402           Node* iff = bol->raw_out(0);
  1401           Node* iff = bol->raw_out(0);
  1403           if (iff->outcnt() == 2) {
  1402           if (use_op == Op_CmpI &&
       
  1403               iff->is_CountedLoopEnd()) {
       
  1404             CountedLoopEndNode* cle = iff->as_CountedLoopEnd();
       
  1405             if (cle->limit() == n && cle->phi() != NULL) {
       
  1406               // If an opaque node feeds into the limit condition of a
       
  1407               // CountedLoop, we need to process the Phi node for the
       
  1408               // induction variable when the opaque node is removed:
       
  1409               // the range of values taken by the Phi is now known and
       
  1410               // so its type is also known.
       
  1411               _worklist.push(cle->phi());
       
  1412             }
       
  1413           } else if (iff->outcnt() == 2) {
       
  1414             // Look for the 'is_x2logic' pattern: "x ? : 0 : 1" and put the
       
  1415             // phi merging either 0 or 1 onto the worklist
  1404             Node* ifproj0 = iff->raw_out(0);
  1416             Node* ifproj0 = iff->raw_out(0);
  1405             Node* ifproj1 = iff->raw_out(1);
  1417             Node* ifproj1 = iff->raw_out(1);
  1406             if (ifproj0->outcnt() > 0 && ifproj1->outcnt() > 0) {
  1418             if (ifproj0->outcnt() > 0 && ifproj1->outcnt() > 0) {
  1407               Node* region0 = ifproj0->raw_out(0);
  1419               Node* region0 = ifproj0->raw_out(0);
  1408               Node* region1 = ifproj1->raw_out(0);
  1420               Node* region1 = ifproj1->raw_out(0);
  1410                 add_users_to_worklist0(region0);
  1422                 add_users_to_worklist0(region0);
  1411             }
  1423             }
  1412           }
  1424           }
  1413         }
  1425         }
  1414       }
  1426       }
  1415     }
  1427       if (use_op == Op_CmpI) {
  1416 
  1428         Node* in1 = use->in(1);
  1417     uint use_op = use->Opcode();
  1429         for (uint i = 0; i < in1->outcnt(); i++) {
       
  1430           if (in1->raw_out(i)->Opcode() == Op_CastII) {
       
  1431             Node* castii = in1->raw_out(i);
       
  1432             if (castii->in(0) != NULL && castii->in(0)->in(0) != NULL && castii->in(0)->in(0)->is_If()) {
       
  1433               Node* ifnode = castii->in(0)->in(0);
       
  1434               if (ifnode->in(1) != NULL && ifnode->in(1)->in(1) == use) {
       
  1435                 // Reprocess a CastII node that may depend on an
       
  1436                 // opaque node value when the opaque node is
       
  1437                 // removed. In case it carries a dependency we can do
       
  1438                 // a better job of computing its type.
       
  1439                 _worklist.push(castii);
       
  1440               }
       
  1441             }
       
  1442           }
       
  1443         }
       
  1444       }
       
  1445     }
       
  1446 
  1418     // If changed Cast input, check Phi users for simple cycles
  1447     // If changed Cast input, check Phi users for simple cycles
  1419     if( use->is_ConstraintCast() || use->is_CheckCastPP() ) {
  1448     if( use->is_ConstraintCast() || use->is_CheckCastPP() ) {
  1420       for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) {
  1449       for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) {
  1421         Node* u = use->fast_out(i2);
  1450         Node* u = use->fast_out(i2);
  1422         if (u->is_Phi())
  1451         if (u->is_Phi())