comparison src/share/vm/opto/subnode.cpp @ 6207:ae9241bbce4a

7181658: CTW: assert(t->meet(t0) == t) failed: Not monotonic Summary: Use uncast node equivalence checks in CmpUNode::sub. Reviewed-by: kvn, twisti Contributed-by: vladimir.x.ivanov@oracle.com
author kvn
date Wed, 11 Jul 2012 14:50:30 -0700
parents 8f6ce6f1049b
children da91efe96a93
comparison
equal deleted inserted replaced
6206:70862d781d01 6207:ae9241bbce4a
552 return TypeInt::CC_EQ; // Equal results 552 return TypeInt::CC_EQ; // Equal results
553 } else if (lo0 >= hi1) { 553 } else if (lo0 >= hi1) {
554 return TypeInt::CC_GE; 554 return TypeInt::CC_GE;
555 } else if (hi0 <= lo1) { 555 } else if (hi0 <= lo1) {
556 // Check for special case in Hashtable::get. (See below.) 556 // Check for special case in Hashtable::get. (See below.)
557 if ((jint)lo0 >= 0 && (jint)lo1 >= 0 && 557 if ((jint)lo0 >= 0 && (jint)lo1 >= 0 && is_index_range_check())
558 in(1)->Opcode() == Op_ModI &&
559 in(1)->in(2) == in(2) )
560 return TypeInt::CC_LT; 558 return TypeInt::CC_LT;
561 return TypeInt::CC_LE; 559 return TypeInt::CC_LE;
562 } 560 }
563 } 561 }
564 // Check for special case in Hashtable::get - the hash index is 562 // Check for special case in Hashtable::get - the hash index is
565 // mod'ed to the table size so the following range check is useless. 563 // mod'ed to the table size so the following range check is useless.
566 // Check for: (X Mod Y) CmpU Y, where the mod result and Y both have 564 // Check for: (X Mod Y) CmpU Y, where the mod result and Y both have
567 // to be positive. 565 // to be positive.
568 // (This is a gross hack, since the sub method never 566 // (This is a gross hack, since the sub method never
569 // looks at the structure of the node in any other case.) 567 // looks at the structure of the node in any other case.)
570 if ((jint)lo0 >= 0 && (jint)lo1 >= 0 && 568 if ((jint)lo0 >= 0 && (jint)lo1 >= 0 && is_index_range_check())
571 in(1)->Opcode() == Op_ModI &&
572 in(1)->in(2)->uncast() == in(2)->uncast())
573 return TypeInt::CC_LT; 569 return TypeInt::CC_LT;
574 return TypeInt::CC; // else use worst case results 570 return TypeInt::CC; // else use worst case results
571 }
572
573 bool CmpUNode::is_index_range_check() const {
574 // Check for the "(X ModI Y) CmpU Y" shape
575 return (in(1)->Opcode() == Op_ModI &&
576 in(1)->in(2)->eqv_uncast(in(2)));
575 } 577 }
576 578
577 //------------------------------Idealize--------------------------------------- 579 //------------------------------Idealize---------------------------------------
578 Node *CmpINode::Ideal( PhaseGVN *phase, bool can_reshape ) { 580 Node *CmpINode::Ideal( PhaseGVN *phase, bool can_reshape ) {
579 if (phase->type(in(2))->higher_equal(TypeInt::ZERO)) { 581 if (phase->type(in(2))->higher_equal(TypeInt::ZERO)) {