changeset 210: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 c0ecab83e6f3
children 8b48a7bd2bf7
files src/share/vm/opto/subnode.cpp
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/opto/subnode.cpp	Tue Jun 10 09:57:24 2008 -0700
+++ b/src/share/vm/opto/subnode.cpp	Thu Jun 12 09:47:55 2008 -0700
@@ -45,10 +45,13 @@
     return in(2)->in(2);
   }
 
-  // Convert "(X+Y) - Y" into X
+  // Convert "(X+Y) - Y" into X and "(X+Y) - X" into Y
   if( in(1)->Opcode() == Op_AddI ) {
     if( phase->eqv(in(1)->in(2),in(2)) )
       return in(1)->in(1);
+    if (phase->eqv(in(1)->in(1),in(2)))
+      return in(1)->in(2);
+
     // Also catch: "(X + Opaque2(Y)) - Y".  In this case, 'Y' is a loop-varying
     // trip counter and X is likely to be loop-invariant (that's how O2 Nodes
     // are originally used, although the optimizer sometimes jiggers things).