@@ -914,16 +914,19 @@ const Type *OrLNode::add_ring( const Type *t0, const Type *t1 ) const {
914914
915915// =============================================================================
916916
917- Node * XorINode::Ideal (PhaseGVN* phase, bool can_reshape) {
917+ const Type * XorINode::Value (PhaseGVN* phase) const {
918918 Node* in1 = in (1 );
919919 Node* in2 = in (2 );
920920 const Type* t1 = phase->type (in1);
921921 const Type* t2 = phase->type (in2);
922- if (t1 != Type::TOP && t2 != Type::TOP && in1 == in2 ) {
923- return new ConINode (TypeInt::ZERO) ;
922+ if (t1 == Type::TOP || t2 == Type::TOP) {
923+ return Type::TOP ;
924924 }
925-
926- return AddNode::Ideal (phase, can_reshape);
925+ // x ^ x ==> 0
926+ if (in1->eqv_uncast (in2)) {
927+ return add_id ();
928+ }
929+ return AddNode::Value (phase);
927930}
928931
929932// ------------------------------add_ring---------------------------------------
@@ -961,15 +964,19 @@ const Type *XorLNode::add_ring( const Type *t0, const Type *t1 ) const {
961964 return TypeLong::make ( r0->get_con () ^ r1->get_con () );
962965}
963966
964- Node * XorLNode::Ideal (PhaseGVN* phase, bool can_reshape) {
967+ const Type * XorLNode::Value (PhaseGVN* phase) const {
965968 Node* in1 = in (1 );
966969 Node* in2 = in (2 );
967970 const Type* t1 = phase->type (in1);
968971 const Type* t2 = phase->type (in2);
969- if (t1 != Type::TOP && t2 != Type::TOP && in1 == in2 ) {
970- return new ConLNode (TypeLong::ZERO) ;
972+ if (t1 == Type::TOP || t2 == Type::TOP) {
973+ return Type::TOP ;
971974 }
972- return AddNode::Ideal (phase, can_reshape);
975+ // x ^ x ==> 0
976+ if (in1->eqv_uncast (in2)) {
977+ return add_id ();
978+ }
979+ return AddNode::Value (phase);
973980}
974981
975982Node* MaxNode::build_min_max (Node* a, Node* b, bool is_max, bool is_unsigned, const Type* t, PhaseGVN& gvn) {
0 commit comments