8154831: CastII/ConvI2L for a range check is prematurely eliminated
authorvlivanov
Fri, 20 May 2016 18:27:03 +0300
changeset 38698 2f5f325d4e6d
parent 38697 110bb528423b
child 38699 f8bec5f6b09c
8154831: CastII/ConvI2L for a range check is prematurely eliminated Reviewed-by: kvn, thartmann
hotspot/src/share/vm/opto/subnode.cpp
--- a/hotspot/src/share/vm/opto/subnode.cpp	Fri May 20 18:05:09 2016 +0300
+++ b/hotspot/src/share/vm/opto/subnode.cpp	Fri May 20 18:27:03 2016 +0300
@@ -578,8 +578,12 @@
     // All unsigned values are LE -1 and GE 0.
     if (lo0 == 0 && hi0 == 0) {
       return TypeInt::CC_LE;            //   0 <= bot
+    } else if ((jint)lo0 == -1 && (jint)hi0 == -1) {
+      return TypeInt::CC_GE;            // -1 >= bot
     } else if (lo1 == 0 && hi1 == 0) {
       return TypeInt::CC_GE;            // bot >= 0
+    } else if ((jint)lo1 == -1 && (jint)hi1 == -1) {
+      return TypeInt::CC_LE;            // bot <= -1
     }
   } else {
     // We can use ranges of the form [lo..hi] if signs are the same.