43 in(2)->Opcode() == Opcode() && |
43 in(2)->Opcode() == Opcode() && |
44 phase->type( in(2)->in(1) )->higher_equal( zero ) ) { |
44 phase->type( in(2)->in(1) )->higher_equal( zero ) ) { |
45 return in(2)->in(2); |
45 return in(2)->in(2); |
46 } |
46 } |
47 |
47 |
48 // Convert "(X+Y) - Y" into X |
48 // Convert "(X+Y) - Y" into X and "(X+Y) - X" into Y |
49 if( in(1)->Opcode() == Op_AddI ) { |
49 if( in(1)->Opcode() == Op_AddI ) { |
50 if( phase->eqv(in(1)->in(2),in(2)) ) |
50 if( phase->eqv(in(1)->in(2),in(2)) ) |
51 return in(1)->in(1); |
51 return in(1)->in(1); |
|
52 if (phase->eqv(in(1)->in(1),in(2))) |
|
53 return in(1)->in(2); |
|
54 |
52 // Also catch: "(X + Opaque2(Y)) - Y". In this case, 'Y' is a loop-varying |
55 // Also catch: "(X + Opaque2(Y)) - Y". In this case, 'Y' is a loop-varying |
53 // trip counter and X is likely to be loop-invariant (that's how O2 Nodes |
56 // trip counter and X is likely to be loop-invariant (that's how O2 Nodes |
54 // are originally used, although the optimizer sometimes jiggers things). |
57 // are originally used, although the optimizer sometimes jiggers things). |
55 // This folding through an O2 removes a loop-exit use of a loop-varying |
58 // This folding through an O2 removes a loop-exit use of a loop-varying |
56 // value and generally lowers register pressure in and around the loop. |
59 // value and generally lowers register pressure in and around the loop. |
738 //============================================================================= |
741 //============================================================================= |
739 //------------------------------sub-------------------------------------------- |
742 //------------------------------sub-------------------------------------------- |
740 // Simplify an CmpN (compare 2 pointers) node, based on local information. |
743 // Simplify an CmpN (compare 2 pointers) node, based on local information. |
741 // If both inputs are constants, compare them. |
744 // If both inputs are constants, compare them. |
742 const Type *CmpNNode::sub( const Type *t1, const Type *t2 ) const { |
745 const Type *CmpNNode::sub( const Type *t1, const Type *t2 ) const { |
743 const TypePtr *r0 = t1->is_narrowoop()->make_oopptr(); // Handy access |
746 const TypePtr *r0 = t1->make_ptr(); // Handy access |
744 const TypePtr *r1 = t2->is_narrowoop()->make_oopptr(); |
747 const TypePtr *r1 = t2->make_ptr(); |
745 |
748 |
746 // Undefined inputs makes for an undefined result |
749 // Undefined inputs makes for an undefined result |
747 if( TypePtr::above_centerline(r0->_ptr) || |
750 if( TypePtr::above_centerline(r0->_ptr) || |
748 TypePtr::above_centerline(r1->_ptr) ) |
751 TypePtr::above_centerline(r1->_ptr) ) |
749 return Type::TOP; |
752 return Type::TOP; |