Mercurial > hg > graal-compiler
comparison src/share/vm/opto/subnode.cpp @ 212:99bf1609e2a5
6697236: missing Identity for "(X+Y) - X" into Y
Reviewed-by: kvn
author | never |
---|---|
date | Thu, 12 Jun 2008 09:47:55 -0700 |
parents | ba764ed4b6f2 |
children | 1e026f8da827 |
comparison
equal
deleted
inserted
replaced
188:c0ecab83e6f3 | 212:99bf1609e2a5 |
---|---|
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. |