diff src/share/vm/opto/subnode.cpp @ 3743:33e2b8f1d466

6956668: misbehavior of XOR operator (^) with int Summary: optimize cmp_ne(xor(X,1),0) to cmp_eq(X,0) only for boolean values X. Reviewed-by: never
author kvn
date Tue, 31 May 2011 10:05:36 -0700
parents f1d6640088a1
children 35acf8f0a2e4
line wrap: on
line diff
--- a/src/share/vm/opto/subnode.cpp	Fri May 27 12:47:48 2011 -0700
+++ b/src/share/vm/opto/subnode.cpp	Tue May 31 10:05:36 2011 -0700
@@ -1101,6 +1101,7 @@
   if( cmp2_type == TypeInt::ZERO &&
       cmp1_op == Op_XorI &&
       j_xor->in(1) != j_xor &&          // An xor of itself is dead
+      phase->type( j_xor->in(1) ) == TypeInt::BOOL &&
       phase->type( j_xor->in(2) ) == TypeInt::ONE &&
       (_test._test == BoolTest::eq ||
        _test._test == BoolTest::ne) ) {