1.1 --- a/src/share/vm/opto/subnode.cpp Tue Jun 10 09:57:24 2008 -0700 1.2 +++ b/src/share/vm/opto/subnode.cpp Thu Jun 12 09:47:55 2008 -0700 1.3 @@ -45,10 +45,13 @@ 1.4 return in(2)->in(2); 1.5 } 1.6 1.7 - // Convert "(X+Y) - Y" into X 1.8 + // Convert "(X+Y) - Y" into X and "(X+Y) - X" into Y 1.9 if( in(1)->Opcode() == Op_AddI ) { 1.10 if( phase->eqv(in(1)->in(2),in(2)) ) 1.11 return in(1)->in(1); 1.12 + if (phase->eqv(in(1)->in(1),in(2))) 1.13 + return in(1)->in(2); 1.14 + 1.15 // Also catch: "(X + Opaque2(Y)) - Y". In this case, 'Y' is a loop-varying 1.16 // trip counter and X is likely to be loop-invariant (that's how O2 Nodes 1.17 // are originally used, although the optimizer sometimes jiggers things).